diff --git a/Ameba.html b/Ameba.html index 16dc5cf7..444acaba 100644 --- a/Ameba.html +++ b/Ameba.html @@ -945,70 +945,70 @@ config.files = file_paths - + ameba.cr
- + ameba/glob_utils.cr
- + ameba/inline_comments.cr
- + ameba/issue.cr
- + ameba/reportable.cr
- + ameba/runner.cr
- + ameba/severity.cr
- + ameba/source.cr
- + ameba/spec/support.cr
- + ameba/tokenizer.cr @@ -1105,7 +1105,7 @@ Can be configured via config parameter.


- [View source] + [View source]
diff --git a/Ameba/AST.html b/Ameba/AST.html index a324c43f..fdb148a0 100644 --- a/Ameba/AST.html +++ b/Ameba/AST.html @@ -923,126 +923,126 @@ - + ameba/ast/branch.cr
- + ameba/ast/branchable.cr
- + ameba/ast/flow_expression.cr
- + ameba/ast/scope.cr
- + ameba/ast/util.cr
- + ameba/ast/variabling/argument.cr
- + ameba/ast/variabling/assignment.cr
- + ameba/ast/variabling/ivariable.cr
- + ameba/ast/variabling/reference.cr
- + ameba/ast/variabling/type_dec_variable.cr
- + ameba/ast/variabling/variable.cr
- + ameba/ast/visitors/base_visitor.cr
- + ameba/ast/visitors/counting_visitor.cr
- + ameba/ast/visitors/flow_expression_visitor.cr
- + ameba/ast/visitors/node_visitor.cr
- + ameba/ast/visitors/redundant_control_expression_visitor.cr
- + ameba/ast/visitors/scope_visitor.cr
- + ameba/ast/visitors/top_level_nodes_visitor.cr diff --git a/Ameba/AST/Argument.html b/Ameba/AST/Argument.html index dbeda95e..2806b3bf 100644 --- a/Ameba/AST/Argument.html +++ b/Ameba/AST/Argument.html @@ -933,7 +933,7 @@ Holds the reference to the variable, thus to scope.

- + ameba/ast/variabling/argument.cr @@ -1105,7 +1105,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1142,7 +1142,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1158,7 +1158,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1174,7 +1174,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1195,7 +1195,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1211,7 +1211,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1227,7 +1227,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1248,7 +1248,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1269,7 +1269,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1285,7 +1285,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1301,7 +1301,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
@@ -1322,7 +1322,7 @@ Holds the reference to the variable, thus to scope.


- [View source] + [View source]
diff --git a/Ameba/AST/Assignment.html b/Ameba/AST/Assignment.html index 04c69fb3..e8860a1f 100644 --- a/Ameba/AST/Assignment.html +++ b/Ameba/AST/Assignment.html @@ -926,7 +926,7 @@ Holds the assign node and the variable.

- + ameba/ast/variabling/assignment.cr @@ -1127,7 +1127,7 @@ Holds the assign node and the variable.


- [View source] + [View source]
@@ -1164,7 +1164,7 @@ Holds the assign node and the variable.


- [View source] + [View source]
@@ -1180,7 +1180,7 @@ Holds the assign node and the variable.


- [View source] + [View source]
@@ -1196,7 +1196,7 @@ Holds the assign node and the variable.


- [View source] + [View source]
@@ -1219,7 +1219,7 @@ For example, this assignment is in a branch:


- [View source] + [View source]
@@ -1235,7 +1235,7 @@ For example, this assignment is in a branch:


- [View source] + [View source]
@@ -1251,7 +1251,7 @@ For example, this assignment is in a branch:


- [View source] + [View source]
@@ -1272,7 +1272,7 @@ For example, this assignment is in a branch:


- [View source] + [View source]
@@ -1295,7 +1295,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1311,7 +1311,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1327,7 +1327,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1343,7 +1343,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1364,7 +1364,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1385,7 +1385,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1401,7 +1401,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1417,7 +1417,7 @@ For example, this is an op assign:


- [View source] + [View source]
@@ -1438,7 +1438,7 @@ For example, this is an op assign:


- [View source] + [View source]
diff --git a/Ameba/AST/BaseVisitor.html b/Ameba/AST/BaseVisitor.html index b7c88810..501b825d 100644 --- a/Ameba/AST/BaseVisitor.html +++ b/Ameba/AST/BaseVisitor.html @@ -943,7 +943,7 @@ - + ameba/ast/visitors/base_visitor.cr @@ -1070,7 +1070,7 @@
- [View source] + [View source]
@@ -1108,7 +1108,7 @@ Returns true, meaning all child nodes will be traversed.


- [View source] + [View source]
diff --git a/Ameba/AST/Branch.html b/Ameba/AST/Branch.html index 1ee5b324..a2250d91 100644 --- a/Ameba/AST/Branch.html +++ b/Ameba/AST/Branch.html @@ -933,7 +933,7 @@ For example, the branchable if statement contains 3 branches:

- + ameba/ast/branch.cr @@ -1131,7 +1131,7 @@ For example, the branchable if statement contains 3 branches:


- [View source] + [View source]
@@ -1165,7 +1165,7 @@ For example, the branchable if statement contains 3 branches:


- [View source] + [View source]
@@ -1187,7 +1187,7 @@ For example, the branchable if statement contains 3 branches:


- [View source] + [View source]
@@ -1240,7 +1240,7 @@ For example, the branchable if statement contains 3 branches:


- [View source] + [View source]
@@ -1256,7 +1256,7 @@ For example, the branchable if statement contains 3 branches:


- [View source] + [View source]
@@ -1307,7 +1307,7 @@ For example, this branch is in a loop:


- [View source] + [View source]
@@ -1323,7 +1323,7 @@ For example, this branch is in a loop:


- [View source] + [View source]
@@ -1339,7 +1339,7 @@ For example, this branch is in a loop:


- [View source] + [View source]
@@ -1360,7 +1360,7 @@ For example, this branch is in a loop:


- [View source] + [View source]
@@ -1381,7 +1381,7 @@ For example, this branch is in a loop:


- [View source] + [View source]
@@ -1397,7 +1397,7 @@ For example, this branch is in a loop:


- [View source] + [View source]
@@ -1413,7 +1413,7 @@ For example, this branch is in a loop:


- [View source] + [View source]
diff --git a/Ameba/AST/Branchable.html b/Ameba/AST/Branchable.html index 11a6fd60..8d17a8dc 100644 --- a/Ameba/AST/Branchable.html +++ b/Ameba/AST/Branchable.html @@ -946,7 +946,7 @@ are branchables.

- + ameba/ast/branchable.cr @@ -1208,7 +1208,7 @@ are branchables.


- [View source] + [View source]
@@ -1245,7 +1245,7 @@ are branchables.


- [View source] + [View source]
@@ -1261,7 +1261,7 @@ are branchables.


- [View source] + [View source]
@@ -1277,7 +1277,7 @@ are branchables.


- [View source] + [View source]
@@ -1293,7 +1293,7 @@ are branchables.


- [View source] + [View source]
@@ -1309,7 +1309,7 @@ are branchables.


- [View source] + [View source]
@@ -1331,7 +1331,7 @@ are branchables.


- [View source] + [View source]
@@ -1352,7 +1352,7 @@ are branchables.


- [View source] + [View source]
@@ -1373,7 +1373,7 @@ are branchables.


- [View source] + [View source]
@@ -1389,7 +1389,7 @@ are branchables.


- [View source] + [View source]
@@ -1405,7 +1405,7 @@ are branchables.


- [View source] + [View source]
diff --git a/Ameba/AST/CountingVisitor.html b/Ameba/AST/CountingVisitor.html index f111dfbb..02b878ba 100644 --- a/Ameba/AST/CountingVisitor.html +++ b/Ameba/AST/CountingVisitor.html @@ -925,7 +925,7 @@ - + ameba/ast/visitors/counting_visitor.cr @@ -1080,7 +1080,7 @@
- [View source] + [View source]
@@ -1117,7 +1117,7 @@
- [View source] + [View source]
@@ -1133,7 +1133,7 @@
- [View source] + [View source]
@@ -1149,7 +1149,7 @@
- [View source] + [View source]
diff --git a/Ameba/AST/FlowExpression.html b/Ameba/AST/FlowExpression.html index c940aaf8..576dac16 100644 --- a/Ameba/AST/FlowExpression.html +++ b/Ameba/AST/FlowExpression.html @@ -948,7 +948,7 @@ a parent node, which allows easily search through the related statement - + ameba/ast/flow_expression.cr @@ -1203,7 +1203,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1235,7 +1235,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1251,7 +1251,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1272,7 +1272,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1288,7 +1288,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1304,7 +1304,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1325,7 +1325,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1341,7 +1341,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1357,7 +1357,7 @@ a parent node, which allows easily search through the related statement
- [View source] + [View source]
@@ -1385,7 +1385,7 @@ For example:


- [View source] + [View source]
diff --git a/Ameba/AST/FlowExpressionVisitor.html b/Ameba/AST/FlowExpressionVisitor.html index bf60cc55..94fd7545 100644 --- a/Ameba/AST/FlowExpressionVisitor.html +++ b/Ameba/AST/FlowExpressionVisitor.html @@ -939,7 +939,7 @@ - + ameba/ast/visitors/flow_expression_visitor.cr diff --git a/Ameba/AST/InstanceVariable.html b/Ameba/AST/InstanceVariable.html index e3a6f67d..3969398b 100644 --- a/Ameba/AST/InstanceVariable.html +++ b/Ameba/AST/InstanceVariable.html @@ -914,7 +914,7 @@ - + ameba/ast/variabling/ivariable.cr @@ -1058,7 +1058,7 @@
- [View source] + [View source]
@@ -1090,7 +1090,7 @@
- [View source] + [View source]
@@ -1106,7 +1106,7 @@
- [View source] + [View source]
@@ -1122,7 +1122,7 @@
- [View source] + [View source]
@@ -1138,7 +1138,7 @@
- [View source] + [View source]
@@ -1154,7 +1154,7 @@
- [View source] + [View source]
@@ -1170,7 +1170,7 @@
- [View source] + [View source]
@@ -1186,7 +1186,7 @@
- [View source] + [View source]
@@ -1202,7 +1202,7 @@
- [View source] + [View source]
@@ -1218,7 +1218,7 @@
- [View source] + [View source]
diff --git a/Ameba/AST/NodeVisitor.html b/Ameba/AST/NodeVisitor.html index 668155cf..0a663d13 100644 --- a/Ameba/AST/NodeVisitor.html +++ b/Ameba/AST/NodeVisitor.html @@ -927,7 +927,7 @@ to be inspected by rules.

- + ameba/ast/visitors/node_visitor.cr @@ -1300,7 +1300,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1316,7 +1316,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1344,7 +1344,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1374,7 +1374,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1397,7 +1397,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1420,7 +1420,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1443,7 +1443,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1466,7 +1466,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1489,7 +1489,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1512,7 +1512,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1535,7 +1535,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1558,7 +1558,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1581,7 +1581,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1604,7 +1604,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1627,7 +1627,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1650,7 +1650,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1673,7 +1673,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1696,7 +1696,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1719,7 +1719,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1742,7 +1742,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1765,7 +1765,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1788,7 +1788,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1811,7 +1811,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1834,7 +1834,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1857,7 +1857,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1880,7 +1880,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1903,7 +1903,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1926,7 +1926,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1949,7 +1949,7 @@ to be inspected by rules.


- [View source] + [View source]
@@ -1965,7 +1965,7 @@ to be inspected by rules.


- [View source] + [View source]
diff --git a/Ameba/AST/NodeVisitor/Category.html b/Ameba/AST/NodeVisitor/Category.html index bf6c1387..87e93923 100644 --- a/Ameba/AST/NodeVisitor/Category.html +++ b/Ameba/AST/NodeVisitor/Category.html @@ -912,7 +912,7 @@ - + ameba/ast/visitors/node_visitor.cr @@ -1065,7 +1065,7 @@
- [View source] + [View source]
@@ -1081,7 +1081,7 @@
- [View source] + [View source]
diff --git a/Ameba/AST/RedundantControlExpressionVisitor.html b/Ameba/AST/RedundantControlExpressionVisitor.html index bf46df0d..db7a7a76 100644 --- a/Ameba/AST/RedundantControlExpressionVisitor.html +++ b/Ameba/AST/RedundantControlExpressionVisitor.html @@ -927,7 +927,7 @@ is reached.

- + ameba/ast/visitors/redundant_control_expression_visitor.cr @@ -1047,7 +1047,7 @@ is reached.


- [View source] + [View source]
@@ -1084,7 +1084,7 @@ is reached.


- [View source] + [View source]
@@ -1105,7 +1105,7 @@ is reached.


- [View source] + [View source]
@@ -1126,7 +1126,7 @@ is reached.


- [View source] + [View source]
diff --git a/Ameba/AST/Reference.html b/Ameba/AST/Reference.html index 12458ecb..d71139b1 100644 --- a/Ameba/AST/Reference.html +++ b/Ameba/AST/Reference.html @@ -927,7 +927,7 @@ the variable from its reference.

- + ameba/ast/variabling/reference.cr @@ -1151,7 +1151,7 @@ the variable from its reference.


- [View source] + [View source]
@@ -1167,7 +1167,7 @@ the variable from its reference.


- [View source] + [View source]
diff --git a/Ameba/AST/Scope.html b/Ameba/AST/Scope.html index 6696b4df..6f48a085 100644 --- a/Ameba/AST/Scope.html +++ b/Ameba/AST/Scope.html @@ -926,7 +926,7 @@ This is where the local variables belong to.

- + ameba/ast/scope.cr @@ -1315,7 +1315,7 @@ This is where the local variables belong to.


- [View source] + [View source]
@@ -1377,7 +1377,7 @@ scope.add_argument(arg_node)
- [View source] + [View source]
@@ -1400,7 +1400,7 @@ scope.add_ivariable(ivar_node)
- [View source] + [View source]
@@ -1423,7 +1423,7 @@ scope.add_type_dec_variable(node)
- [View source] + [View source]
@@ -1446,7 +1446,7 @@ scope.add_variable(var_node)
- [View source] + [View source]
@@ -1467,7 +1467,7 @@ scope.add_variable(var_node)
- [View source] + [View source]
@@ -1488,7 +1488,7 @@ scope.add_variable(var_node)
- [View source] + [View source]
@@ -1511,7 +1511,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1532,7 +1532,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1553,7 +1553,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1575,7 +1575,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1596,7 +1596,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1617,7 +1617,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1633,7 +1633,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1649,7 +1649,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1670,7 +1670,7 @@ scope.assign_variable(var_name, assign_node)
- [View source] + [View source]
@@ -1692,7 +1692,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1715,7 +1715,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1736,7 +1736,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1780,7 +1780,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1801,7 +1801,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1822,7 +1822,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1843,7 +1843,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1859,7 +1859,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1875,7 +1875,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1896,7 +1896,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1917,7 +1917,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1938,7 +1938,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1959,7 +1959,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -1981,7 +1981,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -2005,7 +2005,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -2021,7 +2021,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -2037,7 +2037,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -2058,7 +2058,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -2079,7 +2079,7 @@ scope.find_variable("foo")
- [View source] + [View source]
@@ -2101,7 +2101,7 @@ type definition, for example a class.


- [View source] + [View source]
@@ -2122,7 +2122,7 @@ type definition, for example a class.


- [View source] + [View source]
@@ -2143,7 +2143,7 @@ type definition, for example a class.


- [View source] + [View source]
@@ -2164,7 +2164,7 @@ type definition, for example a class.


- [View source] + [View source]
@@ -2185,7 +2185,7 @@ type definition, for example a class.


- [View source] + [View source]
@@ -2207,7 +2207,7 @@ type definition, for example a class.


- [View source] + [View source]
diff --git a/Ameba/AST/ScopeVisitor.html b/Ameba/AST/ScopeVisitor.html index 3debbff3..798c6f18 100644 --- a/Ameba/AST/ScopeVisitor.html +++ b/Ameba/AST/ScopeVisitor.html @@ -925,7 +925,7 @@ - + ameba/ast/visitors/scope_visitor.cr @@ -1084,7 +1084,7 @@
- [View source] + [View source]
diff --git a/Ameba/AST/TopLevelNodesVisitor.html b/Ameba/AST/TopLevelNodesVisitor.html index 7b441107..175518da 100644 --- a/Ameba/AST/TopLevelNodesVisitor.html +++ b/Ameba/AST/TopLevelNodesVisitor.html @@ -926,7 +926,7 @@ can characterize the source (i.e. require statements, modules etc.)

- + ameba/ast/visitors/top_level_nodes_visitor.cr @@ -1064,7 +1064,7 @@ can characterize the source (i.e. require statements, modules etc.)


- [View source] + [View source]
@@ -1096,7 +1096,7 @@ can characterize the source (i.e. require statements, modules etc.)


- [View source] + [View source]
@@ -1118,7 +1118,7 @@ then always traverse the children.


- [View source] + [View source]
@@ -1140,7 +1140,7 @@ Returns false, meaning all child nodes will not be traversed.


- [View source] + [View source]
diff --git a/Ameba/AST/TypeDecVariable.html b/Ameba/AST/TypeDecVariable.html index 08cd42b4..87038750 100644 --- a/Ameba/AST/TypeDecVariable.html +++ b/Ameba/AST/TypeDecVariable.html @@ -914,7 +914,7 @@ - + ameba/ast/variabling/type_dec_variable.cr @@ -1053,7 +1053,7 @@
- [View source] + [View source]
@@ -1085,7 +1085,7 @@
- [View source] + [View source]
@@ -1101,7 +1101,7 @@
- [View source] + [View source]
@@ -1117,7 +1117,7 @@
- [View source] + [View source]
@@ -1133,7 +1133,7 @@
- [View source] + [View source]
@@ -1149,7 +1149,7 @@
- [View source] + [View source]
@@ -1165,7 +1165,7 @@
- [View source] + [View source]
@@ -1181,7 +1181,7 @@
- [View source] + [View source]
@@ -1197,7 +1197,7 @@
- [View source] + [View source]
diff --git a/Ameba/AST/Util.html b/Ameba/AST/Util.html index c03892ff..a623aae5 100644 --- a/Ameba/AST/Util.html +++ b/Ameba/AST/Util.html @@ -995,7 +995,7 @@ - + ameba/ast/util.cr @@ -1174,7 +1174,7 @@
- [View source] + [View source]
@@ -1196,7 +1196,7 @@ Wraps implicit tuple literal with curly brackets (e.g. multi-return).


- [View source] + [View source]
@@ -1217,7 +1217,7 @@ Wraps implicit tuple literal with curly brackets (e.g. multi-return).


- [View source] + [View source]
@@ -1238,7 +1238,7 @@ Wraps implicit tuple literal with curly brackets (e.g. multi-return).


- [View source] + [View source]
@@ -1261,7 +1261,7 @@ or special call node that interrupts execution (i.e. raise, exit, abort).


- [View source] + [View source]
@@ -1297,7 +1297,7 @@ a flow command return:


- [View source] + [View source]
@@ -1318,7 +1318,7 @@ a flow command return:


- [View source] + [View source]
@@ -1339,7 +1339,7 @@ a flow command return:


- [View source] + [View source]
@@ -1362,7 +1362,7 @@ off-by-one error.


- [View source] + [View source]
@@ -1383,7 +1383,7 @@ off-by-one error.


- [View source] + [View source]
@@ -1404,7 +1404,7 @@ off-by-one error.


- [View source] + [View source]
@@ -1427,7 +1427,7 @@ to determine and cut a piece of source of the node.


- [View source] + [View source]
@@ -1449,7 +1449,7 @@ matching given name, false otherwise.


- [View source] + [View source]
@@ -1470,7 +1470,7 @@ matching given name, false otherwise.


- [View source] + [View source]
@@ -1491,7 +1491,7 @@ matching given name, false otherwise.


- [View source] + [View source]
@@ -1512,7 +1512,7 @@ matching given name, false otherwise.


- [View source] + [View source]
diff --git a/Ameba/AST/Variable.html b/Ameba/AST/Variable.html index 2a535dd6..a745e231 100644 --- a/Ameba/AST/Variable.html +++ b/Ameba/AST/Variable.html @@ -940,7 +940,7 @@ Holds the var node and variable assignments.

- + ameba/ast/variabling/variable.cr @@ -1206,7 +1206,7 @@ Holds the var node and variable assignments.


- [View source] + [View source]
@@ -1248,7 +1248,7 @@ variable.assignment.size # => 2
- [View source] + [View source]
@@ -1269,7 +1269,7 @@ variable.assignment.size # => 2
- [View source] + [View source]
@@ -1290,7 +1290,7 @@ variable.assignment.size # => 2
- [View source] + [View source]
@@ -1318,7 +1318,7 @@ by block:


- [View source] + [View source]
@@ -1339,7 +1339,7 @@ by block:


- [View source] + [View source]
@@ -1355,7 +1355,7 @@ by block:


- [View source] + [View source]
@@ -1371,7 +1371,7 @@ by block:


- [View source] + [View source]
@@ -1393,7 +1393,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1414,7 +1414,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1430,7 +1430,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1446,7 +1446,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1462,7 +1462,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1478,7 +1478,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1499,7 +1499,7 @@ the same Crystal node as @node.


- [View source] + [View source]
@@ -1522,7 +1522,7 @@ variable.reference(var_node, some_scope)
- [View source] + [View source]
@@ -1545,7 +1545,7 @@ variable.reference(var_node, some_scope)
- [View source] + [View source]
@@ -1569,7 +1569,7 @@ variable.reference_assignments!
- [View source] + [View source]
@@ -1593,7 +1593,7 @@ variable.referenced? # => true
- [View source] + [View source]
@@ -1614,7 +1614,7 @@ variable.referenced? # => true
- [View source] + [View source]
@@ -1635,7 +1635,7 @@ variable.referenced? # => true
- [View source] + [View source]
@@ -1656,7 +1656,7 @@ variable.referenced? # => true
- [View source] + [View source]
@@ -1678,7 +1678,7 @@ variable.referenced? # => true
- [View source] + [View source]
@@ -1694,7 +1694,7 @@ variable.referenced? # => true
- [View source] + [View source]
@@ -1710,7 +1710,7 @@ variable.referenced? # => true
- [View source] + [View source]
@@ -1732,7 +1732,7 @@ variable.referenced? # => true
- [View source] + [View source]
diff --git a/Ameba/Config.html b/Ameba/Config.html index c0201e5b..b6edc36c 100644 --- a/Ameba/Config.html +++ b/Ameba/Config.html @@ -965,7 +965,7 @@ then it will use the config as specified inside the first of the following files - + ameba/config.cr @@ -1243,7 +1243,7 @@ then it will use the config as specified inside the first of the following files
- [View source] + [View source]
@@ -1265,7 +1265,7 @@ then it will use the config as specified inside the first of the following files
- [View source] + [View source]
@@ -1300,7 +1300,7 @@ then it will use the config as specified inside the first of the following files
- [View source] + [View source]
@@ -1321,7 +1321,7 @@ then it will use the config as specified inside the first of the following files
- [View source] + [View source]
@@ -1345,7 +1345,7 @@ config.excluded = ["spec"
- [View source] + [View source]
@@ -1369,7 +1369,7 @@ config.excluded = ["spec"
- [View source] + [View source]
@@ -1394,7 +1394,7 @@ config.formatter
- [View source] + [View source]
@@ -1417,7 +1417,7 @@ config.formatter = :progress
- [View source] + [View source]
@@ -1442,7 +1442,7 @@ config.formatter
- [View source] + [View source]
@@ -1468,7 +1468,7 @@ config.globs
- [View source] + [View source]
@@ -1494,7 +1494,7 @@ config.globs
- [View source] + [View source]
@@ -1510,7 +1510,7 @@ config.globs
- [View source] + [View source]
@@ -1526,7 +1526,7 @@ config.globs
- [View source] + [View source]
@@ -1542,7 +1542,7 @@ config.globs
- [View source] + [View source]
@@ -1568,7 +1568,7 @@ config.sources # => list of sources pointing to files found b
- [View source] + [View source]
@@ -1591,7 +1591,7 @@ config.update_rule "MyRuleName", enabled:
- [View source] + [View source]
@@ -1616,7 +1616,7 @@ config.update_rules %w[Rule1 Rule2], enabled:
- [View source] + [View source]
diff --git a/Ameba/Ext.html b/Ameba/Ext.html index 37cef799..d8a457c6 100644 --- a/Ameba/Ext.html +++ b/Ameba/Ext.html @@ -912,7 +912,7 @@ - + ameba/ext/location.cr diff --git a/Ameba/Ext/Location.html b/Ameba/Ext/Location.html index 59fe3ae0..6ccb064b 100644 --- a/Ameba/Ext/Location.html +++ b/Ameba/Ext/Location.html @@ -937,7 +937,7 @@ - + ameba/ext/location.cr @@ -1026,7 +1026,7 @@ by the given amount(s).


- [View source] + [View source]
@@ -1047,7 +1047,7 @@ by the given amount(s).


- [View source] + [View source]
@@ -1069,7 +1069,7 @@ to the given value(s).


- [View source] + [View source]
diff --git a/Ameba/Formatter.html b/Ameba/Formatter.html index 0e8aac7a..f22d7f58 100644 --- a/Ameba/Formatter.html +++ b/Ameba/Formatter.html @@ -923,56 +923,56 @@ - + ameba/formatter/base_formatter.cr
- + ameba/formatter/disabled_formatter.cr
- + ameba/formatter/dot_formatter.cr
- + ameba/formatter/explain_formatter.cr
- + ameba/formatter/flycheck_formatter.cr
- + ameba/formatter/json_formatter.cr
- + ameba/formatter/todo_formatter.cr
- + ameba/formatter/util.cr diff --git a/Ameba/Formatter/BaseFormatter.html b/Ameba/Formatter/BaseFormatter.html index 708d4486..7bdcb7e7 100644 --- a/Ameba/Formatter/BaseFormatter.html +++ b/Ameba/Formatter/BaseFormatter.html @@ -947,7 +947,7 @@ callbacks in Ameba:: - + ameba/formatter/base_formatter.cr @@ -1086,7 +1086,7 @@ callbacks in Ameba::
@@ -1118,7 +1118,7 @@ callbacks in Ameba::
@@ -1140,7 +1140,7 @@ A list of inspected sources is passed as an argument.


@@ -1161,7 +1161,7 @@ A list of inspected sources is passed as an argument.


@@ -1183,7 +1183,7 @@ A corresponding source is passed as an argument.


@@ -1205,7 +1205,7 @@ A corresponding source is passed as an argument.


@@ -1227,7 +1227,7 @@ A list of sources to inspect is passed as an argument.


diff --git a/Ameba/Formatter/DisabledFormatter.html b/Ameba/Formatter/DisabledFormatter.html index cc4effe2..7bfb6223 100644 --- a/Ameba/Formatter/DisabledFormatter.html +++ b/Ameba/Formatter/DisabledFormatter.html @@ -925,7 +925,7 @@ - + ameba/formatter/disabled_formatter.cr @@ -1086,7 +1086,7 @@ A list of inspected sources is passed as an argument.


diff --git a/Ameba/Formatter/DotFormatter.html b/Ameba/Formatter/DotFormatter.html index f297e51a..3d2ef632 100644 --- a/Ameba/Formatter/DotFormatter.html +++ b/Ameba/Formatter/DotFormatter.html @@ -954,7 +954,7 @@ It is similar to Crystal's dot formatter for specs.

- + ameba/formatter/dot_formatter.cr @@ -1161,7 +1161,7 @@ It is similar to Crystal's dot formatter for specs.


@@ -1182,7 +1182,7 @@ It is similar to Crystal's dot formatter for specs.


@@ -1203,7 +1203,7 @@ It is similar to Crystal's dot formatter for specs.


diff --git a/Ameba/Formatter/ExplainFormatter.html b/Ameba/Formatter/ExplainFormatter.html index e0ec983a..d071fb0b 100644 --- a/Ameba/Formatter/ExplainFormatter.html +++ b/Ameba/Formatter/ExplainFormatter.html @@ -940,7 +940,7 @@ a specific location.

- + ameba/formatter/explain_formatter.cr @@ -1107,7 +1107,7 @@ Second argument is location which indicates the location to explain.

@@ -1144,7 +1144,7 @@ Second argument is location which indicates the location to explain.

@@ -1160,7 +1160,7 @@ Second argument is location which indicates the location to explain.

@@ -1176,7 +1176,7 @@ Second argument is location which indicates the location to explain.

diff --git a/Ameba/Formatter/FlycheckFormatter.html b/Ameba/Formatter/FlycheckFormatter.html index f5b5f912..fced3634 100644 --- a/Ameba/Formatter/FlycheckFormatter.html +++ b/Ameba/Formatter/FlycheckFormatter.html @@ -914,7 +914,7 @@ - + ameba/formatter/flycheck_formatter.cr @@ -1075,7 +1075,7 @@ A corresponding source is passed as an argument.


diff --git a/Ameba/Formatter/JSONFormatter.html b/Ameba/Formatter/JSONFormatter.html index a091d4c3..0720211d 100644 --- a/Ameba/Formatter/JSONFormatter.html +++ b/Ameba/Formatter/JSONFormatter.html @@ -981,7 +981,7 @@ - + ameba/formatter/json_formatter.cr @@ -1157,7 +1157,7 @@
@@ -1199,7 +1199,7 @@ A list of inspected sources is passed as an argument.


@@ -1225,7 +1225,7 @@ A corresponding source is passed as an argument.


@@ -1251,7 +1251,7 @@ A list of sources to inspect is passed as an argument.


diff --git a/Ameba/Formatter/TODOFormatter.html b/Ameba/Formatter/TODOFormatter.html index 8ec5944f..eec81002 100644 --- a/Ameba/Formatter/TODOFormatter.html +++ b/Ameba/Formatter/TODOFormatter.html @@ -927,7 +927,7 @@ or excludes failed sources from these rules.

- + ameba/formatter/todo_formatter.cr @@ -1158,7 +1158,7 @@ or excludes failed sources from these rules.


@@ -1199,7 +1199,7 @@ or excludes failed sources from these rules.


diff --git a/Ameba/Formatter/Util.html b/Ameba/Formatter/Util.html index f4ca8503..01e2493d 100644 --- a/Ameba/Formatter/Util.html +++ b/Ameba/Formatter/Util.html @@ -942,7 +942,7 @@ - + ameba/formatter/util.cr @@ -1029,7 +1029,7 @@
@@ -1045,7 +1045,7 @@
@@ -1061,7 +1061,7 @@
@@ -1077,7 +1077,7 @@
@@ -1093,7 +1093,7 @@
diff --git a/Ameba/GlobUtils.html b/Ameba/GlobUtils.html index 59d695b3..14ce9636 100644 --- a/Ameba/GlobUtils.html +++ b/Ameba/GlobUtils.html @@ -906,6 +906,20 @@ +

+ + + + Extended Modules +

+ + @@ -937,7 +951,7 @@ - + ameba/glob_utils.cr @@ -1019,7 +1033,7 @@
@@ -1042,7 +1056,7 @@ Globs can have wildcards or be rejected:


diff --git a/Ameba/InlineComments.html b/Ameba/InlineComments.html index a2b0c422..e3892006 100644 --- a/Ameba/InlineComments.html +++ b/Ameba/InlineComments.html @@ -937,7 +937,7 @@ - + ameba/inline_comments.cr @@ -1044,7 +1044,7 @@
@@ -1084,7 +1084,7 @@
@@ -1113,7 +1113,7 @@ parse_inline_directive(line) # => nil

diff --git a/Ameba/InlineComments/Action.html b/Ameba/InlineComments/Action.html index 0f9c086e..2647d312 100644 --- a/Ameba/InlineComments/Action.html +++ b/Ameba/InlineComments/Action.html @@ -923,7 +923,7 @@ - + ameba/inline_comments.cr @@ -1071,7 +1071,7 @@
@@ -1087,7 +1087,7 @@
diff --git a/Ameba/Issue.html b/Ameba/Issue.html index 9c640531..740a047c 100644 --- a/Ameba/Issue.html +++ b/Ameba/Issue.html @@ -925,7 +925,7 @@ - + ameba/issue.cr @@ -1114,7 +1114,7 @@
@@ -1151,7 +1151,7 @@
@@ -1167,7 +1167,7 @@
@@ -1183,7 +1183,7 @@
@@ -1199,7 +1199,7 @@
@@ -1215,7 +1215,7 @@
@@ -1231,7 +1231,7 @@
@@ -1247,7 +1247,7 @@
@@ -1268,7 +1268,7 @@
@@ -1289,7 +1289,7 @@
@@ -1310,7 +1310,7 @@
@@ -1331,7 +1331,7 @@
@@ -1352,7 +1352,7 @@
@@ -1368,7 +1368,7 @@
diff --git a/Ameba/Issue/Status.html b/Ameba/Issue/Status.html index 00dac920..93e31b6d 100644 --- a/Ameba/Issue/Status.html +++ b/Ameba/Issue/Status.html @@ -912,7 +912,7 @@ - + ameba/issue.cr @@ -1060,7 +1060,7 @@
@@ -1076,7 +1076,7 @@
diff --git a/Ameba/Presenter.html b/Ameba/Presenter.html index a975f209..88e53b14 100644 --- a/Ameba/Presenter.html +++ b/Ameba/Presenter.html @@ -912,21 +912,21 @@ - + ameba/presenter/base_presenter.cr
- + ameba/presenter/rule_collection_presenter.cr
- + ameba/presenter/rule_presenter.cr diff --git a/Ameba/Presenter/BasePresenter.html b/Ameba/Presenter/BasePresenter.html index f014a1f2..0dc1f22d 100644 --- a/Ameba/Presenter/BasePresenter.html +++ b/Ameba/Presenter/BasePresenter.html @@ -930,7 +930,7 @@ - + ameba/presenter/base_presenter.cr @@ -1036,7 +1036,7 @@
@@ -1073,7 +1073,7 @@
diff --git a/Ameba/Presenter/RuleCollectionPresenter.html b/Ameba/Presenter/RuleCollectionPresenter.html index 8bae2a11..1a80603c 100644 --- a/Ameba/Presenter/RuleCollectionPresenter.html +++ b/Ameba/Presenter/RuleCollectionPresenter.html @@ -914,7 +914,7 @@ - + ameba/presenter/rule_collection_presenter.cr @@ -1038,7 +1038,7 @@
diff --git a/Ameba/Presenter/RulePresenter.html b/Ameba/Presenter/RulePresenter.html index df3fee6a..323c0967 100644 --- a/Ameba/Presenter/RulePresenter.html +++ b/Ameba/Presenter/RulePresenter.html @@ -914,7 +914,7 @@ - + ameba/presenter/rule_presenter.cr @@ -1038,7 +1038,7 @@
diff --git a/Ameba/Reportable.html b/Ameba/Reportable.html index 9eecfd83..681ff21d 100644 --- a/Ameba/Reportable.html +++ b/Ameba/Reportable.html @@ -951,7 +951,7 @@ - + ameba/reportable.cr @@ -1199,7 +1199,7 @@
@@ -1220,7 +1220,7 @@
@@ -1241,7 +1241,7 @@
@@ -1262,7 +1262,7 @@
@@ -1283,7 +1283,7 @@
@@ -1304,7 +1304,7 @@
@@ -1325,7 +1325,7 @@
@@ -1346,7 +1346,7 @@
@@ -1367,7 +1367,7 @@
@@ -1388,7 +1388,7 @@
@@ -1409,7 +1409,7 @@
@@ -1430,7 +1430,7 @@
diff --git a/Ameba/Rule.html b/Ameba/Rule.html index c0f35fd2..650320ba 100644 --- a/Ameba/Rule.html +++ b/Ameba/Rule.html @@ -912,7 +912,7 @@ - + ameba/rule/base.cr @@ -1007,7 +1007,7 @@ behave differently than usual rules.


diff --git a/Ameba/Rule/Base.html b/Ameba/Rule/Base.html index f94172f4..2ebbba92 100644 --- a/Ameba/Rule/Base.html +++ b/Ameba/Rule/Base.html @@ -1102,7 +1102,7 @@ that are tested by this rule, it should add an issue.

- + ameba/rule/base.cr @@ -1357,7 +1357,7 @@ that are tested by this rule, it should add an issue.


@@ -1394,7 +1394,7 @@ that are tested by this rule, it should add an issue.


@@ -1418,7 +1418,7 @@ source.valid?

- [View source] + [View source]
@@ -1442,7 +1442,7 @@ the one of the given source.


- [View source] + [View source]
@@ -1468,7 +1468,7 @@ the one of the given source.


- [View source] + [View source]
@@ -1498,7 +1498,7 @@ though usually the macro def_hash can be used to generate this meth
- [View source] + [View source]
@@ -1525,7 +1525,7 @@ though usually the macro def_hash can be used to generate this meth
- [View source] + [View source]
@@ -1548,7 +1548,7 @@ usual rules.


- [View source] + [View source]
@@ -1569,7 +1569,7 @@ usual rules.


- [View source] + [View source]
@@ -1593,7 +1593,7 @@ that are tested by this rule, it should add an issue.


- [View source] + [View source]
diff --git a/Ameba/Rule/Documentation.html b/Ameba/Rule/Documentation.html index 07f9ead8..5a85ca80 100644 --- a/Ameba/Rule/Documentation.html +++ b/Ameba/Rule/Documentation.html @@ -912,14 +912,14 @@ - + ameba/rule/documentation/documentation.cr
- + ameba/rule/documentation/documentation_admonition.cr diff --git a/Ameba/Rule/Documentation/Documentation.html b/Ameba/Rule/Documentation/Documentation.html index 573546ab..7737b91d 100644 --- a/Ameba/Rule/Documentation/Documentation.html +++ b/Ameba/Rule/Documentation/Documentation.html @@ -951,7 +951,7 @@ modules, classes, enums, methods and macros.

- + ameba/rule/documentation/documentation.cr @@ -1382,7 +1382,7 @@ modules, classes, enums, methods and macros.


- [View source] + [View source]
@@ -1733,7 +1733,7 @@ modules, classes, enums, methods and macros.


- [View source] + [View source]
@@ -1749,7 +1749,7 @@ modules, classes, enums, methods and macros.


- [View source] + [View source]
@@ -1765,7 +1765,7 @@ modules, classes, enums, methods and macros.


- [View source] + [View source]
@@ -1781,7 +1781,7 @@ modules, classes, enums, methods and macros.


- [View source] + [View source]
@@ -1797,7 +1797,7 @@ modules, classes, enums, methods and macros.


- [View source] + [View source]
@@ -1813,7 +1813,7 @@ modules, classes, enums, methods and macros.


- [View source] + [View source]
diff --git a/Ameba/Rule/Documentation/DocumentationAdmonition.html b/Ameba/Rule/Documentation/DocumentationAdmonition.html index 0a5fc684..2926eea6 100644 --- a/Ameba/Rule/Documentation/DocumentationAdmonition.html +++ b/Ameba/Rule/Documentation/DocumentationAdmonition.html @@ -961,7 +961,7 @@ and are therefore reported by Ameba.

- + ameba/rule/documentation/documentation_admonition.cr @@ -1342,7 +1342,7 @@ and are therefore reported by Ameba.


- [View source] + [View source]
@@ -1553,7 +1553,7 @@ and are therefore reported by Ameba.


- [View source] + [View source]
diff --git a/Ameba/Rule/Layout.html b/Ameba/Rule/Layout.html index 5c03693b..66563cda 100644 --- a/Ameba/Rule/Layout.html +++ b/Ameba/Rule/Layout.html @@ -912,21 +912,21 @@ - + ameba/rule/layout/line_length.cr
- + ameba/rule/layout/trailing_blank_lines.cr
- + ameba/rule/layout/trailing_whitespace.cr diff --git a/Ameba/Rule/Layout/LineLength.html b/Ameba/Rule/Layout/LineLength.html index 91b0fdd1..429b90f1 100644 --- a/Ameba/Rule/Layout/LineLength.html +++ b/Ameba/Rule/Layout/LineLength.html @@ -945,7 +945,7 @@ - + ameba/rule/layout/line_length.cr @@ -1290,7 +1290,7 @@
- [View source] + [View source]
@@ -1501,7 +1501,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Layout/TrailingBlankLines.html b/Ameba/Rule/Layout/TrailingBlankLines.html index 51179752..8dc2e9bd 100644 --- a/Ameba/Rule/Layout/TrailingBlankLines.html +++ b/Ameba/Rule/Layout/TrailingBlankLines.html @@ -944,7 +944,7 @@ - + ameba/rule/layout/trailing_blank_lines.cr @@ -1283,7 +1283,7 @@
- [View source] + [View source]
@@ -1466,7 +1466,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Layout/TrailingWhitespace.html b/Ameba/Rule/Layout/TrailingWhitespace.html index b9b96dfb..289f5bb7 100644 --- a/Ameba/Rule/Layout/TrailingWhitespace.html +++ b/Ameba/Rule/Layout/TrailingWhitespace.html @@ -944,7 +944,7 @@ - + ameba/rule/layout/trailing_whitespace.cr @@ -1278,7 +1278,7 @@
- [View source] + [View source]
@@ -1461,7 +1461,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint.html b/Ameba/Rule/Lint.html index 48b4a21e..f264c361 100644 --- a/Ameba/Rule/Lint.html +++ b/Ameba/Rule/Lint.html @@ -912,259 +912,259 @@ - + ameba/rule/lint/ambiguous_assignment.cr
- + ameba/rule/lint/bad_directive.cr
- + ameba/rule/lint/comparison_to_boolean.cr
- + ameba/rule/lint/debug_calls.cr
- + ameba/rule/lint/debugger_statement.cr
- + ameba/rule/lint/duplicated_require.cr
- + ameba/rule/lint/empty_ensure.cr
- + ameba/rule/lint/empty_expression.cr
- + ameba/rule/lint/empty_loop.cr
- + ameba/rule/lint/formatting.cr
- + ameba/rule/lint/hash_duplicated_key.cr
- + ameba/rule/lint/literal_assignments_in_expressions.cr
- + ameba/rule/lint/literal_in_condition.cr
- + ameba/rule/lint/literal_in_interpolation.cr
- + ameba/rule/lint/literals_comparison.cr
- + ameba/rule/lint/missing_block_argument.cr
- + ameba/rule/lint/not_nil.cr
- + ameba/rule/lint/not_nil_after_no_bang.cr
- + ameba/rule/lint/percent_array.cr
- + ameba/rule/lint/rand_zero.cr
- + ameba/rule/lint/redundant_string_coercion.cr
- + ameba/rule/lint/redundant_with_index.cr
- + ameba/rule/lint/redundant_with_object.cr
- + ameba/rule/lint/shadowed_argument.cr
- + ameba/rule/lint/shadowed_exception.cr
- + ameba/rule/lint/shadowing_outer_local_var.cr
- + ameba/rule/lint/shared_var_in_fiber.cr
- + ameba/rule/lint/spec_filename.cr
- + ameba/rule/lint/spec_focus.cr
- + ameba/rule/lint/syntax.cr
- + ameba/rule/lint/typos.cr
- + ameba/rule/lint/unneeded_disable_directive.cr
- + ameba/rule/lint/unreachable_code.cr
- + ameba/rule/lint/unused_argument.cr
- + ameba/rule/lint/unused_block_argument.cr
- + ameba/rule/lint/useless_assign.cr
- + ameba/rule/lint/useless_condition_in_when.cr diff --git a/Ameba/Rule/Lint/AmbiguousAssignment.html b/Ameba/Rule/Lint/AmbiguousAssignment.html index 95c60d25..6a26eaff 100644 --- a/Ameba/Rule/Lint/AmbiguousAssignment.html +++ b/Ameba/Rule/Lint/AmbiguousAssignment.html @@ -954,7 +954,7 @@ x != y # or x = !y
- + ameba/rule/lint/ambiguous_assignment.cr @@ -1398,7 +1398,7 @@ x != y # or x = !y
- [View source] + [View source]
@@ -1581,7 +1581,7 @@ x != y # or x = !y
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/BadDirective.html b/Ameba/Rule/Lint/BadDirective.html index 0365cd26..72fecfc7 100644 --- a/Ameba/Rule/Lint/BadDirective.html +++ b/Ameba/Rule/Lint/BadDirective.html @@ -950,7 +950,7 @@ to disable a rule that even doesn't exist:

- + ameba/rule/lint/bad_directive.cr @@ -1300,7 +1300,7 @@ to disable a rule that even doesn't exist:


- [View source] + [View source]
@@ -1483,7 +1483,7 @@ to disable a rule that even doesn't exist:


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/ComparisonToBoolean.html b/Ameba/Rule/Lint/ComparisonToBoolean.html index 8cdb0606..afb536ad 100644 --- a/Ameba/Rule/Lint/ComparisonToBoolean.html +++ b/Ameba/Rule/Lint/ComparisonToBoolean.html @@ -953,7 +953,7 @@ or negating the variable.

- + ameba/rule/lint/comparison_to_boolean.cr @@ -1396,7 +1396,7 @@ or negating the variable.


- [View source] + [View source]
@@ -1579,7 +1579,7 @@ or negating the variable.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/DebugCalls.html b/Ameba/Rule/Lint/DebugCalls.html index 6da35180..b3a64702 100644 --- a/Ameba/Rule/Lint/DebugCalls.html +++ b/Ameba/Rule/Lint/DebugCalls.html @@ -951,7 +951,7 @@ committed into our codebase.

- + ameba/rule/lint/debug_calls.cr @@ -1302,7 +1302,7 @@ committed into our codebase.


- [View source] + [View source]
@@ -1513,7 +1513,7 @@ committed into our codebase.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/DebuggerStatement.html b/Ameba/Rule/Lint/DebuggerStatement.html index d9d6cf65..8f6c3314 100644 --- a/Ameba/Rule/Lint/DebuggerStatement.html +++ b/Ameba/Rule/Lint/DebuggerStatement.html @@ -946,7 +946,7 @@ committed into our codebase.

- + ameba/rule/lint/debugger_statement.cr @@ -1282,7 +1282,7 @@ committed into our codebase.


- [View source] + [View source]
@@ -1465,7 +1465,7 @@ committed into our codebase.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/DuplicatedRequire.html b/Ameba/Rule/Lint/DuplicatedRequire.html index 56c539e0..b28b3680 100644 --- a/Ameba/Rule/Lint/DuplicatedRequire.html +++ b/Ameba/Rule/Lint/DuplicatedRequire.html @@ -947,7 +947,7 @@ - + ameba/rule/lint/duplicated_require.cr @@ -1284,7 +1284,7 @@
- [View source] + [View source]
@@ -1467,7 +1467,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/EmptyEnsure.html b/Ameba/Rule/Lint/EmptyEnsure.html index eec235a7..5a4980a7 100644 --- a/Ameba/Rule/Lint/EmptyEnsure.html +++ b/Ameba/Rule/Lint/EmptyEnsure.html @@ -966,7 +966,7 @@ - + ameba/rule/lint/empty_ensure.cr @@ -1322,7 +1322,7 @@
- [View source] + [View source]
@@ -1505,7 +1505,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/EmptyExpression.html b/Ameba/Rule/Lint/EmptyExpression.html index 8c71f311..6d213f85 100644 --- a/Ameba/Rule/Lint/EmptyExpression.html +++ b/Ameba/Rule/Lint/EmptyExpression.html @@ -956,7 +956,7 @@ - + ameba/rule/lint/empty_expression.cr @@ -1302,7 +1302,7 @@
- [View source] + [View source]
@@ -1485,7 +1485,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/EmptyLoop.html b/Ameba/Rule/Lint/EmptyLoop.html index 5abe8731..3c314e29 100644 --- a/Ameba/Rule/Lint/EmptyLoop.html +++ b/Ameba/Rule/Lint/EmptyLoop.html @@ -968,7 +968,7 @@ loop do - + ameba/rule/lint/empty_loop.cr @@ -1426,7 +1426,7 @@ loop do
- [View source] + [View source]
@@ -1609,7 +1609,7 @@ loop do
- [View source] + [View source]
@@ -1625,7 +1625,7 @@ loop do
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/Formatting.html b/Ameba/Rule/Lint/Formatting.html index 95bec165..56803b66 100644 --- a/Ameba/Rule/Lint/Formatting.html +++ b/Ameba/Rule/Lint/Formatting.html @@ -956,7 +956,7 @@ Crystal's built-in formatter.

- + ameba/rule/lint/formatting.cr @@ -1317,7 +1317,7 @@ Crystal's built-in formatter.


- [View source] + [View source]
@@ -1528,7 +1528,7 @@ Crystal's built-in formatter.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/HashDuplicatedKey.html b/Ameba/Rule/Lint/HashDuplicatedKey.html index 3eb25ca1..8a7f3445 100644 --- a/Ameba/Rule/Lint/HashDuplicatedKey.html +++ b/Ameba/Rule/Lint/HashDuplicatedKey.html @@ -948,7 +948,7 @@ - + ameba/rule/lint/hash_duplicated_key.cr @@ -1286,7 +1286,7 @@
- [View source] + [View source]
@@ -1469,7 +1469,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html b/Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html index 299bfdb3..edc0fa75 100644 --- a/Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html +++ b/Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html @@ -955,7 +955,7 @@ in control expressions.

- + ameba/rule/lint/literal_assignments_in_expressions.cr @@ -1395,7 +1395,7 @@ in control expressions.


- [View source] + [View source]
@@ -1578,7 +1578,7 @@ in control expressions.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/LiteralInCondition.html b/Ameba/Rule/Lint/LiteralInCondition.html index 395eb1cd..1e4b246c 100644 --- a/Ameba/Rule/Lint/LiteralInCondition.html +++ b/Ameba/Rule/Lint/LiteralInCondition.html @@ -954,7 +954,7 @@ replaced with either the body of the construct, or deleted entirely.

- + ameba/rule/lint/literal_in_condition.cr @@ -1393,7 +1393,7 @@ replaced with either the body of the construct, or deleted entirely.


- [View source] + [View source]
@@ -1576,7 +1576,7 @@ replaced with either the body of the construct, or deleted entirely.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/LiteralInInterpolation.html b/Ameba/Rule/Lint/LiteralInInterpolation.html index 93f50d8e..51537d2b 100644 --- a/Ameba/Rule/Lint/LiteralInInterpolation.html +++ b/Ameba/Rule/Lint/LiteralInInterpolation.html @@ -950,7 +950,7 @@ that contain a literal value instead of a variable or function.

- + ameba/rule/lint/literal_in_interpolation.cr @@ -1385,7 +1385,7 @@ that contain a literal value instead of a variable or function.


- [View source] + [View source]
@@ -1568,7 +1568,7 @@ that contain a literal value instead of a variable or function.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/LiteralsComparison.html b/Ameba/Rule/Lint/LiteralsComparison.html index 7941426a..79b91564 100644 --- a/Ameba/Rule/Lint/LiteralsComparison.html +++ b/Ameba/Rule/Lint/LiteralsComparison.html @@ -950,7 +950,7 @@ types like containers, range or regex.

- + ameba/rule/lint/literals_comparison.cr @@ -1395,7 +1395,7 @@ types like containers, range or regex.


- [View source] + [View source]
@@ -1578,7 +1578,7 @@ types like containers, range or regex.


- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/MissingBlockArgument.html b/Ameba/Rule/Lint/MissingBlockArgument.html index 488336db..f9770468 100644 --- a/Ameba/Rule/Lint/MissingBlockArgument.html +++ b/Ameba/Rule/Lint/MissingBlockArgument.html @@ -952,7 +952,7 @@ - + ameba/rule/lint/missing_block_argument.cr @@ -1299,7 +1299,7 @@
- [View source] + [View source]
@@ -1482,7 +1482,7 @@
- [View source] + [View source]
@@ -1498,7 +1498,7 @@
- [View source] + [View source]
diff --git a/Ameba/Rule/Lint/NotNil.html b/Ameba/Rule/Lint/NotNil.html index d4597bb7..83009d88 100644 --- a/Ameba/Rule/Lint/NotNil.html +++ b/Ameba/Rule/Lint/NotNil.html @@ -954,7 +954,7 @@ alice = names.find { |name - + ameba/rule/lint/not_nil.cr @@ -1303,7 +1303,7 @@ alice = names.find { |name @@ -1486,7 +1486,7 @@ alice = names.find { |name @@ -1502,7 +1502,7 @@ alice = names.find { |name diff --git a/Ameba/Rule/Lint/NotNilAfterNoBang.html b/Ameba/Rule/Lint/NotNilAfterNoBang.html index 5e673c32..3d393264 100644 --- a/Ameba/Rule/Lint/NotNilAfterNoBang.html +++ b/Ameba/Rule/Lint/NotNilAfterNoBang.html @@ -951,7 +951,7 @@ followed by a call to not_nil!.

- + ameba/rule/lint/not_nil_after_no_bang.cr @@ -1402,7 +1402,7 @@ followed by a call to not_nil!.


@@ -1585,7 +1585,7 @@ followed by a call to not_nil!.


@@ -1601,7 +1601,7 @@ followed by a call to not_nil!.


diff --git a/Ameba/Rule/Lint/PercentArrays.html b/Ameba/Rule/Lint/PercentArrays.html index f48b9bfc..18219603 100644 --- a/Ameba/Rule/Lint/PercentArrays.html +++ b/Ameba/Rule/Lint/PercentArrays.html @@ -952,7 +952,7 @@ - + ameba/rule/lint/percent_array.cr @@ -1314,7 +1314,7 @@
@@ -1553,7 +1553,7 @@
diff --git a/Ameba/Rule/Lint/RandZero.html b/Ameba/Rule/Lint/RandZero.html index f371c795..ac5ba35d 100644 --- a/Ameba/Rule/Lint/RandZero.html +++ b/Ameba/Rule/Lint/RandZero.html @@ -951,7 +951,7 @@ rand(2) - + ameba/rule/lint/rand_zero.cr @@ -1292,7 +1292,7 @@ rand(2)
@@ -1475,7 +1475,7 @@ rand(2)
diff --git a/Ameba/Rule/Lint/RedundantStringCoercion.html b/Ameba/Rule/Lint/RedundantStringCoercion.html index 3507f950..1679b203 100644 --- a/Ameba/Rule/Lint/RedundantStringCoercion.html +++ b/Ameba/Rule/Lint/RedundantStringCoercion.html @@ -951,7 +951,7 @@ which is redundant.

- + ameba/rule/lint/redundant_string_coercion.cr @@ -1387,7 +1387,7 @@ which is redundant.


@@ -1570,7 +1570,7 @@ which is redundant.


diff --git a/Ameba/Rule/Lint/RedundantWithIndex.html b/Ameba/Rule/Lint/RedundantWithIndex.html index 948b0c61..2e8ec463 100644 --- a/Ameba/Rule/Lint/RedundantWithIndex.html +++ b/Ameba/Rule/Lint/RedundantWithIndex.html @@ -956,7 +956,7 @@ collection.each_with_index do |e, - + ameba/rule/lint/redundant_with_index.cr @@ -1283,7 +1283,7 @@ collection.each_with_index do |e,
@@ -1466,7 +1466,7 @@ collection.each_with_index do |e,
diff --git a/Ameba/Rule/Lint/RedundantWithObject.html b/Ameba/Rule/Lint/RedundantWithObject.html index f9797cb4..a5e6bae3 100644 --- a/Ameba/Rule/Lint/RedundantWithObject.html +++ b/Ameba/Rule/Lint/RedundantWithObject.html @@ -956,7 +956,7 @@ collection.each_with_object(0) do - + ameba/rule/lint/redundant_with_object.cr @@ -1302,7 +1302,7 @@ collection.each_with_object(0) do
@@ -1485,7 +1485,7 @@ collection.each_with_object(0) do
diff --git a/Ameba/Rule/Lint/ShadowedArgument.html b/Ameba/Rule/Lint/ShadowedArgument.html index bde44150..de2db57e 100644 --- a/Ameba/Rule/Lint/ShadowedArgument.html +++ b/Ameba/Rule/Lint/ShadowedArgument.html @@ -964,7 +964,7 @@ - + ameba/rule/lint/shadowed_argument.cr @@ -1323,7 +1323,7 @@
@@ -1506,7 +1506,7 @@
@@ -1522,7 +1522,7 @@
diff --git a/Ameba/Rule/Lint/ShadowedException.html b/Ameba/Rule/Lint/ShadowedException.html index f1b3a4ac..ac1ceada 100644 --- a/Ameba/Rule/Lint/ShadowedException.html +++ b/Ameba/Rule/Lint/ShadowedException.html @@ -962,7 +962,7 @@ exception is rescued.

- + ameba/rule/lint/shadowed_exception.cr @@ -1314,7 +1314,7 @@ exception is rescued.


@@ -1497,7 +1497,7 @@ exception is rescued.


diff --git a/Ameba/Rule/Lint/ShadowingOuterLocalVar.html b/Ameba/Rule/Lint/ShadowingOuterLocalVar.html index 4983cb4d..6c81a703 100644 --- a/Ameba/Rule/Lint/ShadowingOuterLocalVar.html +++ b/Ameba/Rule/Lint/ShadowingOuterLocalVar.html @@ -959,7 +959,7 @@ for block or proc arguments.

- + ameba/rule/lint/shadowing_outer_local_var.cr @@ -1313,7 +1313,7 @@ for block or proc arguments.


@@ -1496,7 +1496,7 @@ for block or proc arguments.


@@ -1512,7 +1512,7 @@ for block or proc arguments.


diff --git a/Ameba/Rule/Lint/SharedVarInFiber.html b/Ameba/Rule/Lint/SharedVarInFiber.html index 8ea1e340..b0141351 100644 --- a/Ameba/Rule/Lint/SharedVarInFiber.html +++ b/Ameba/Rule/Lint/SharedVarInFiber.html @@ -974,7 +974,7 @@ the second one.

- + ameba/rule/lint/shared_var_in_fiber.cr @@ -1343,7 +1343,7 @@ the second one.


@@ -1526,7 +1526,7 @@ the second one.


@@ -1542,7 +1542,7 @@ the second one.


diff --git a/Ameba/Rule/Lint/SpecFilename.html b/Ameba/Rule/Lint/SpecFilename.html index 843b26d1..3cccffcc 100644 --- a/Ameba/Rule/Lint/SpecFilename.html +++ b/Ameba/Rule/Lint/SpecFilename.html @@ -946,7 +946,7 @@ - + ameba/rule/lint/spec_filename.cr @@ -1304,7 +1304,7 @@
@@ -1548,7 +1548,7 @@
diff --git a/Ameba/Rule/Lint/SpecFocus.html b/Ameba/Rule/Lint/SpecFocus.html index 3526233f..39e42050 100644 --- a/Ameba/Rule/Lint/SpecFocus.html +++ b/Ameba/Rule/Lint/SpecFocus.html @@ -972,7 +972,7 @@ it "works" do - + ameba/rule/lint/spec_focus.cr @@ -1344,7 +1344,7 @@ it "works" do
@@ -1527,7 +1527,7 @@ it "works" do
@@ -1543,7 +1543,7 @@ it "works" do
diff --git a/Ameba/Rule/Lint/Syntax.html b/Ameba/Rule/Lint/Syntax.html index 3944a841..7bd53a0d 100644 --- a/Ameba/Rule/Lint/Syntax.html +++ b/Ameba/Rule/Lint/Syntax.html @@ -951,7 +951,7 @@ - + ameba/rule/lint/syntax.cr @@ -1273,7 +1273,7 @@
@@ -1456,7 +1456,7 @@
diff --git a/Ameba/Rule/Lint/Typos.html b/Ameba/Rule/Lint/Typos.html index 1bf1fd09..edb02933 100644 --- a/Ameba/Rule/Lint/Typos.html +++ b/Ameba/Rule/Lint/Typos.html @@ -948,7 +948,7 @@ - + ameba/rule/lint/typos.cr @@ -1313,7 +1313,7 @@
@@ -1384,7 +1384,7 @@
@@ -1566,7 +1566,7 @@ that are tested by this rule, it should add an issue.


diff --git a/Ameba/Rule/Lint/UnneededDisableDirective.html b/Ameba/Rule/Lint/UnneededDisableDirective.html index aa2b5c33..9a64e91a 100644 --- a/Ameba/Rule/Lint/UnneededDisableDirective.html +++ b/Ameba/Rule/Lint/UnneededDisableDirective.html @@ -954,7 +954,7 @@ have any effect, the snippet should be written as the following:

- + ameba/rule/lint/unneeded_disable_directive.cr @@ -1298,7 +1298,7 @@ have any effect, the snippet should be written as the following:


@@ -1481,7 +1481,7 @@ have any effect, the snippet should be written as the following:


diff --git a/Ameba/Rule/Lint/UnreachableCode.html b/Ameba/Rule/Lint/UnreachableCode.html index 894dcf4f..54895bc2 100644 --- a/Ameba/Rule/Lint/UnreachableCode.html +++ b/Ameba/Rule/Lint/UnreachableCode.html @@ -964,7 +964,7 @@ loop do - + ameba/rule/lint/unreachable_code.cr @@ -1323,7 +1323,7 @@ loop do
@@ -1506,7 +1506,7 @@ loop do
@@ -1522,7 +1522,7 @@ loop do
diff --git a/Ameba/Rule/Lint/UnusedArgument.html b/Ameba/Rule/Lint/UnusedArgument.html index 40daef5e..d6151637 100644 --- a/Ameba/Rule/Lint/UnusedArgument.html +++ b/Ameba/Rule/Lint/UnusedArgument.html @@ -955,7 +955,7 @@ For example, this is considered invalid:

- + ameba/rule/lint/unused_argument.cr @@ -1345,7 +1345,7 @@ For example, this is considered invalid:


@@ -1612,7 +1612,7 @@ For example, this is considered invalid:


@@ -1628,7 +1628,7 @@ For example, this is considered invalid:


@@ -1644,7 +1644,7 @@ For example, this is considered invalid:


@@ -1660,7 +1660,7 @@ For example, this is considered invalid:


diff --git a/Ameba/Rule/Lint/UnusedBlockArgument.html b/Ameba/Rule/Lint/UnusedBlockArgument.html index c57fa8c2..01117763 100644 --- a/Ameba/Rule/Lint/UnusedBlockArgument.html +++ b/Ameba/Rule/Lint/UnusedBlockArgument.html @@ -960,7 +960,7 @@ For example, this is considered invalid:

- + ameba/rule/lint/unused_block_argument.cr @@ -1320,7 +1320,7 @@ For example, this is considered invalid:


@@ -1503,7 +1503,7 @@ For example, this is considered invalid:


@@ -1519,7 +1519,7 @@ For example, this is considered invalid:


diff --git a/Ameba/Rule/Lint/UselessAssign.html b/Ameba/Rule/Lint/UselessAssign.html index 08e43cf3..b1e1dceb 100644 --- a/Ameba/Rule/Lint/UselessAssign.html +++ b/Ameba/Rule/Lint/UselessAssign.html @@ -955,7 +955,7 @@ - + ameba/rule/lint/useless_assign.cr @@ -1315,7 +1315,7 @@
@@ -1526,7 +1526,7 @@
@@ -1542,7 +1542,7 @@
diff --git a/Ameba/Rule/Lint/UselessConditionInWhen.html b/Ameba/Rule/Lint/UselessConditionInWhen.html index 47171eb6..f34b9790 100644 --- a/Ameba/Rule/Lint/UselessConditionInWhen.html +++ b/Ameba/Rule/Lint/UselessConditionInWhen.html @@ -959,7 +959,7 @@ where it is guaranteed to always return the same result.

- + ameba/rule/lint/useless_condition_in_when.cr @@ -1308,7 +1308,7 @@ where it is guaranteed to always return the same result.


@@ -1491,7 +1491,7 @@ where it is guaranteed to always return the same result.


diff --git a/Ameba/Rule/Metrics.html b/Ameba/Rule/Metrics.html index 7275cd0f..dde765a9 100644 --- a/Ameba/Rule/Metrics.html +++ b/Ameba/Rule/Metrics.html @@ -912,7 +912,7 @@ - + ameba/rule/metrics/cyclomatic_complexity.cr diff --git a/Ameba/Rule/Metrics/CyclomaticComplexity.html b/Ameba/Rule/Metrics/CyclomaticComplexity.html index 0308262e..fe9d2920 100644 --- a/Ameba/Rule/Metrics/CyclomaticComplexity.html +++ b/Ameba/Rule/Metrics/CyclomaticComplexity.html @@ -945,7 +945,7 @@ - + ameba/rule/metrics/cyclomatic_complexity.cr @@ -1290,7 +1290,7 @@
@@ -1501,7 +1501,7 @@
diff --git a/Ameba/Rule/Naming.html b/Ameba/Rule/Naming.html index 43dd43e2..1434b25b 100644 --- a/Ameba/Rule/Naming.html +++ b/Ameba/Rule/Naming.html @@ -912,84 +912,84 @@ - + ameba/rule/naming/accessor_method_name.cr
- + ameba/rule/naming/ascii_identifiers.cr
- + ameba/rule/naming/binary_operator_parameter_name.cr
- + ameba/rule/naming/block_parameter_name.cr
- + ameba/rule/naming/constant_names.cr
- + ameba/rule/naming/filename.cr
- + ameba/rule/naming/method_names.cr
- + ameba/rule/naming/predicate_name.cr
- + ameba/rule/naming/query_bool_methods.cr
- + ameba/rule/naming/rescued_exceptions_variable_name.cr
- + ameba/rule/naming/type_names.cr
- + ameba/rule/naming/variable_names.cr diff --git a/Ameba/Rule/Naming/AccessorMethodName.html b/Ameba/Rule/Naming/AccessorMethodName.html index 2afc2c82..e4cfe82f 100644 --- a/Ameba/Rule/Naming/AccessorMethodName.html +++ b/Ameba/Rule/Naming/AccessorMethodName.html @@ -964,7 +964,7 @@ - + ameba/rule/naming/accessor_method_name.cr @@ -1323,7 +1323,7 @@
@@ -1506,7 +1506,7 @@
@@ -1522,7 +1522,7 @@
diff --git a/Ameba/Rule/Naming/AsciiIdentifiers.html b/Ameba/Rule/Naming/AsciiIdentifiers.html index a47126f6..795628bd 100644 --- a/Ameba/Rule/Naming/AsciiIdentifiers.html +++ b/Ameba/Rule/Naming/AsciiIdentifiers.html @@ -951,7 +951,7 @@ - + ameba/rule/naming/ascii_identifiers.cr @@ -1327,7 +1327,7 @@
@@ -1538,7 +1538,7 @@
@@ -1554,7 +1554,7 @@
@@ -1570,7 +1570,7 @@
@@ -1586,7 +1586,7 @@
@@ -1602,7 +1602,7 @@
@@ -1618,7 +1618,7 @@
diff --git a/Ameba/Rule/Naming/BinaryOperatorParameterName.html b/Ameba/Rule/Naming/BinaryOperatorParameterName.html index fb5a9579..0de34b8b 100644 --- a/Ameba/Rule/Naming/BinaryOperatorParameterName.html +++ b/Ameba/Rule/Naming/BinaryOperatorParameterName.html @@ -956,7 +956,7 @@ their sole parameter named other.

- + ameba/rule/naming/binary_operator_parameter_name.cr @@ -1312,7 +1312,7 @@ their sole parameter named other.


@@ -1523,7 +1523,7 @@ their sole parameter named other.


diff --git a/Ameba/Rule/Naming/BlockParameterName.html b/Ameba/Rule/Naming/BlockParameterName.html index 258c7f93..ad40269f 100644 --- a/Ameba/Rule/Naming/BlockParameterName.html +++ b/Ameba/Rule/Naming/BlockParameterName.html @@ -952,7 +952,7 @@ - + ameba/rule/naming/block_parameter_name.cr @@ -1334,7 +1334,7 @@
@@ -1629,7 +1629,7 @@
diff --git a/Ameba/Rule/Naming/ConstantNames.html b/Ameba/Rule/Naming/ConstantNames.html index a7795c4e..45ed07bb 100644 --- a/Ameba/Rule/Naming/ConstantNames.html +++ b/Ameba/Rule/Naming/ConstantNames.html @@ -950,7 +950,7 @@ - + ameba/rule/naming/constant_names.cr @@ -1290,7 +1290,7 @@
@@ -1473,7 +1473,7 @@
diff --git a/Ameba/Rule/Naming/Filename.html b/Ameba/Rule/Naming/Filename.html index b9272ce9..d01940e5 100644 --- a/Ameba/Rule/Naming/Filename.html +++ b/Ameba/Rule/Naming/Filename.html @@ -944,7 +944,7 @@ - + ameba/rule/naming/filename.cr @@ -1280,7 +1280,7 @@
@@ -1475,7 +1475,7 @@ that are tested by this rule, it should add an issue.


diff --git a/Ameba/Rule/Naming/MethodNames.html b/Ameba/Rule/Naming/MethodNames.html index 66c2d1f1..d9627572 100644 --- a/Ameba/Rule/Naming/MethodNames.html +++ b/Ameba/Rule/Naming/MethodNames.html @@ -966,7 +966,7 @@ - + ameba/rule/naming/method_names.cr @@ -1322,7 +1322,7 @@
@@ -1505,7 +1505,7 @@
diff --git a/Ameba/Rule/Naming/PredicateName.html b/Ameba/Rule/Naming/PredicateName.html index 204fdcfc..dea9452b 100644 --- a/Ameba/Rule/Naming/PredicateName.html +++ b/Ameba/Rule/Naming/PredicateName.html @@ -952,7 +952,7 @@ the ones that are not valid Crystal code (e.g. is_404?).

- + ameba/rule/naming/predicate_name.cr @@ -1294,7 +1294,7 @@ the ones that are not valid Crystal code (e.g. is_404?).


@@ -1477,7 +1477,7 @@ the ones that are not valid Crystal code (e.g. is_404?).


diff --git a/Ameba/Rule/Naming/QueryBoolMethods.html b/Ameba/Rule/Naming/QueryBoolMethods.html index d17a8fa5..b4ac4f08 100644 --- a/Ameba/Rule/Naming/QueryBoolMethods.html +++ b/Ameba/Rule/Naming/QueryBoolMethods.html @@ -957,7 +957,7 @@ using Object#(class_)property or Object#(class_)getter - + ameba/rule/naming/query_bool_methods.cr @@ -1404,7 +1404,7 @@ using Object#(class_)property or Object#(class_)getter
@@ -1587,7 +1587,7 @@ using Object#(class_)property or Object#(class_)getter
diff --git a/Ameba/Rule/Naming/RescuedExceptionsVariableName.html b/Ameba/Rule/Naming/RescuedExceptionsVariableName.html index 2a32e7a8..13beb30c 100644 --- a/Ameba/Rule/Naming/RescuedExceptionsVariableName.html +++ b/Ameba/Rule/Naming/RescuedExceptionsVariableName.html @@ -957,7 +957,7 @@ - + ameba/rule/naming/rescued_exceptions_variable_name.cr @@ -1319,7 +1319,7 @@
@@ -1530,7 +1530,7 @@
diff --git a/Ameba/Rule/Naming/TypeNames.html b/Ameba/Rule/Naming/TypeNames.html index 28e6f7e2..f521e7e2 100644 --- a/Ameba/Rule/Naming/TypeNames.html +++ b/Ameba/Rule/Naming/TypeNames.html @@ -980,7 +980,7 @@ - + ameba/rule/naming/type_names.cr @@ -1350,7 +1350,7 @@
@@ -1533,7 +1533,7 @@
diff --git a/Ameba/Rule/Naming/VariableNames.html b/Ameba/Rule/Naming/VariableNames.html index 817f5bb7..da33c1e9 100644 --- a/Ameba/Rule/Naming/VariableNames.html +++ b/Ameba/Rule/Naming/VariableNames.html @@ -951,7 +951,7 @@ wrong_Name = 2 - + ameba/rule/naming/variable_names.cr @@ -1299,7 +1299,7 @@ wrong_Name = 2
@@ -1482,7 +1482,7 @@ wrong_Name = 2
@@ -1510,7 +1510,7 @@ that are tested by this rule, it should add an issue.


diff --git a/Ameba/Rule/Performance.html b/Ameba/Rule/Performance.html index 49b04e2b..7fce5448 100644 --- a/Ameba/Rule/Performance.html +++ b/Ameba/Rule/Performance.html @@ -912,77 +912,77 @@ - + ameba/rule/performance/any_after_filter.cr
- + ameba/rule/performance/any_instead_of_empty.cr
- + ameba/rule/performance/base.cr
- + ameba/rule/performance/chained_call_with_no_bang.cr
- + ameba/rule/performance/compact_after_map.cr
- + ameba/rule/performance/excessive_allocations.cr
- + ameba/rule/performance/first_last_after_filter.cr
- + ameba/rule/performance/flatten_after_map.cr
- + ameba/rule/performance/map_instead_of_block.cr
- + ameba/rule/performance/minmax_after_map.cr
- + ameba/rule/performance/size_after_filter.cr diff --git a/Ameba/Rule/Performance/AnyAfterFilter.html b/Ameba/Rule/Performance/AnyAfterFilter.html index 20ae201a..87256e2f 100644 --- a/Ameba/Rule/Performance/AnyAfterFilter.html +++ b/Ameba/Rule/Performance/AnyAfterFilter.html @@ -955,7 +955,7 @@ - + ameba/rule/performance/any_after_filter.cr @@ -1490,7 +1490,7 @@
@@ -1701,7 +1701,7 @@
diff --git a/Ameba/Rule/Performance/AnyInsteadOfEmpty.html b/Ameba/Rule/Performance/AnyInsteadOfEmpty.html index 0a10152d..513c8483 100644 --- a/Ameba/Rule/Performance/AnyInsteadOfEmpty.html +++ b/Ameba/Rule/Performance/AnyInsteadOfEmpty.html @@ -953,7 +953,7 @@ one value present.

- + ameba/rule/performance/any_instead_of_empty.cr @@ -1381,7 +1381,7 @@ one value present.


@@ -1564,7 +1564,7 @@ one value present.


diff --git a/Ameba/Rule/Performance/Base.html b/Ameba/Rule/Performance/Base.html index 0f9d5b4f..112a25dd 100644 --- a/Ameba/Rule/Performance/Base.html +++ b/Ameba/Rule/Performance/Base.html @@ -973,7 +973,7 @@ - + ameba/rule/performance/base.cr @@ -1247,7 +1247,7 @@
@@ -1330,7 +1330,7 @@ source.valid?
diff --git a/Ameba/Rule/Performance/ChainedCallWithNoBang.html b/Ameba/Rule/Performance/ChainedCallWithNoBang.html index 2fbbaa32..1f7af1cc 100644 --- a/Ameba/Rule/Performance/ChainedCallWithNoBang.html +++ b/Ameba/Rule/Performance/ChainedCallWithNoBang.html @@ -965,7 +965,7 @@ chars = names - + ameba/rule/performance/chained_call_with_no_bang.cr @@ -1534,7 +1534,7 @@ chars = names
@@ -1745,7 +1745,7 @@ chars = names
@@ -1761,7 +1761,7 @@ chars = names
diff --git a/Ameba/Rule/Performance/CompactAfterMap.html b/Ameba/Rule/Performance/CompactAfterMap.html index 56894cfa..973d054b 100644 --- a/Ameba/Rule/Performance/CompactAfterMap.html +++ b/Ameba/Rule/Performance/CompactAfterMap.html @@ -950,7 +950,7 @@ - + ameba/rule/performance/compact_after_map.cr @@ -1470,7 +1470,7 @@
@@ -1653,7 +1653,7 @@
@@ -1669,7 +1669,7 @@
diff --git a/Ameba/Rule/Performance/ExcessiveAllocations.html b/Ameba/Rule/Performance/ExcessiveAllocations.html index 33e8a6b4..c1bb11ff 100644 --- a/Ameba/Rule/Performance/ExcessiveAllocations.html +++ b/Ameba/Rule/Performance/ExcessiveAllocations.html @@ -958,7 +958,7 @@ that can be avoided by using each_<member> instead of & - + ameba/rule/performance/excessive_allocations.cr @@ -1504,7 +1504,7 @@ that can be avoided by using each_<member> instead of &
@@ -1715,7 +1715,7 @@ that can be avoided by using each_<member> instead of &
@@ -1731,7 +1731,7 @@ that can be avoided by using each_<member> instead of &
diff --git a/Ameba/Rule/Performance/FirstLastAfterFilter.html b/Ameba/Rule/Performance/FirstLastAfterFilter.html index 0e11ead2..c00d128a 100644 --- a/Ameba/Rule/Performance/FirstLastAfterFilter.html +++ b/Ameba/Rule/Performance/FirstLastAfterFilter.html @@ -954,7 +954,7 @@ - + ameba/rule/performance/first_last_after_filter.cr @@ -1502,7 +1502,7 @@
@@ -1713,7 +1713,7 @@
@@ -1729,7 +1729,7 @@
diff --git a/Ameba/Rule/Performance/FlattenAfterMap.html b/Ameba/Rule/Performance/FlattenAfterMap.html index f15810d8..653bf77b 100644 --- a/Ameba/Rule/Performance/FlattenAfterMap.html +++ b/Ameba/Rule/Performance/FlattenAfterMap.html @@ -950,7 +950,7 @@ - + ameba/rule/performance/flatten_after_map.cr @@ -1470,7 +1470,7 @@
@@ -1653,7 +1653,7 @@
@@ -1669,7 +1669,7 @@
diff --git a/Ameba/Rule/Performance/MapInsteadOfBlock.html b/Ameba/Rule/Performance/MapInsteadOfBlock.html index eaf13097..f729bf15 100644 --- a/Ameba/Rule/Performance/MapInsteadOfBlock.html +++ b/Ameba/Rule/Performance/MapInsteadOfBlock.html @@ -951,7 +951,7 @@ that follow map.

- + ameba/rule/performance/map_instead_of_block.cr @@ -1478,7 +1478,7 @@ that follow map.


@@ -1661,7 +1661,7 @@ that follow map.


@@ -1677,7 +1677,7 @@ that follow map.


diff --git a/Ameba/Rule/Performance/MinMaxAfterMap.html b/Ameba/Rule/Performance/MinMaxAfterMap.html index 33c7fa45..bd848832 100644 --- a/Ameba/Rule/Performance/MinMaxAfterMap.html +++ b/Ameba/Rule/Performance/MinMaxAfterMap.html @@ -954,7 +954,7 @@ - + ameba/rule/performance/minmax_after_map.cr @@ -1487,7 +1487,7 @@
@@ -1670,7 +1670,7 @@
@@ -1686,7 +1686,7 @@
diff --git a/Ameba/Rule/Performance/SizeAfterFilter.html b/Ameba/Rule/Performance/SizeAfterFilter.html index fc86bf02..10360ff0 100644 --- a/Ameba/Rule/Performance/SizeAfterFilter.html +++ b/Ameba/Rule/Performance/SizeAfterFilter.html @@ -961,7 +961,7 @@ - + ameba/rule/performance/size_after_filter.cr @@ -1513,7 +1513,7 @@
@@ -1724,7 +1724,7 @@
@@ -1740,7 +1740,7 @@
diff --git a/Ameba/Rule/Style.html b/Ameba/Rule/Style.html index c720e38f..cb64bad8 100644 --- a/Ameba/Rule/Style.html +++ b/Ameba/Rule/Style.html @@ -912,84 +912,84 @@ - + ameba/rule/style/guard_clause.cr
- + ameba/rule/style/is_a_filter.cr
- + ameba/rule/style/is_a_nil.cr
- + ameba/rule/style/large_numbers.cr
- + ameba/rule/style/negated_conditions_in_unless.cr
- + ameba/rule/style/parentheses_around_condition.cr
- + ameba/rule/style/redundant_begin.cr
- + ameba/rule/style/redundant_next.cr
- + ameba/rule/style/redundant_return.cr
- + ameba/rule/style/unless_else.cr
- + ameba/rule/style/verbose_block.cr
- + ameba/rule/style/while_true.cr diff --git a/Ameba/Rule/Style/GuardClause.html b/Ameba/Rule/Style/GuardClause.html index 1fa8c1e3..e968210a 100644 --- a/Ameba/Rule/Style/GuardClause.html +++ b/Ameba/Rule/Style/GuardClause.html @@ -987,7 +987,7 @@ ok
- + ameba/rule/style/guard_clause.cr @@ -1474,7 +1474,7 @@ ok

@@ -1629,7 +1629,7 @@ ok

@@ -1673,7 +1673,7 @@ ok

@@ -1689,7 +1689,7 @@ ok
@@ -1705,7 +1705,7 @@ ok
diff --git a/Ameba/Rule/Style/IsAFilter.html b/Ameba/Rule/Style/IsAFilter.html index 0cf787f5..a5085ed2 100644 --- a/Ameba/Rule/Style/IsAFilter.html +++ b/Ameba/Rule/Style/IsAFilter.html @@ -969,7 +969,7 @@ matches.one?(Nil) # => tr - + ameba/rule/style/is_a_filter.cr @@ -1448,7 +1448,7 @@ matches.one?(Nil) # => tr
@@ -1659,7 +1659,7 @@ matches.one?(Nil) # => tr
@@ -1675,7 +1675,7 @@ matches.one?(Nil) # => tr
diff --git a/Ameba/Rule/Style/IsANil.html b/Ameba/Rule/Style/IsANil.html index b1f6ffe2..3928880b 100644 --- a/Ameba/Rule/Style/IsANil.html +++ b/Ameba/Rule/Style/IsANil.html @@ -950,7 +950,7 @@ - + ameba/rule/style/is_a_nil.cr @@ -1385,7 +1385,7 @@
@@ -1568,7 +1568,7 @@
diff --git a/Ameba/Rule/Style/LargeNumbers.html b/Ameba/Rule/Style/LargeNumbers.html index 3894dd82..beb4b933 100644 --- a/Ameba/Rule/Style/LargeNumbers.html +++ b/Ameba/Rule/Style/LargeNumbers.html @@ -955,7 +955,7 @@ large numbers more easily.

- + ameba/rule/style/large_numbers.cr @@ -1310,7 +1310,7 @@ large numbers more easily.


@@ -1521,7 +1521,7 @@ large numbers more easily.


diff --git a/Ameba/Rule/Style/NegatedConditionsInUnless.html b/Ameba/Rule/Style/NegatedConditionsInUnless.html index 2bc794ee..058bcb4f 100644 --- a/Ameba/Rule/Style/NegatedConditionsInUnless.html +++ b/Ameba/Rule/Style/NegatedConditionsInUnless.html @@ -954,7 +954,7 @@ that is executed if a negated condition is NOT met.

- + ameba/rule/style/negated_conditions_in_unless.cr @@ -1298,7 +1298,7 @@ that is executed if a negated condition is NOT met.


@@ -1481,7 +1481,7 @@ that is executed if a negated condition is NOT met.


diff --git a/Ameba/Rule/Style/ParenthesesAroundCondition.html b/Ameba/Rule/Style/ParenthesesAroundCondition.html index 620de28b..97f44a2c 100644 --- a/Ameba/Rule/Style/ParenthesesAroundCondition.html +++ b/Ameba/Rule/Style/ParenthesesAroundCondition.html @@ -955,7 +955,7 @@ around the condition of if, unless, case, - + ameba/rule/style/parentheses_around_condition.cr @@ -1325,7 +1325,7 @@ around the condition of if, unless, case,
@@ -1564,7 +1564,7 @@ around the condition of if, unless, case,
diff --git a/Ameba/Rule/Style/RedundantBegin.html b/Ameba/Rule/Style/RedundantBegin.html index 93d0bad2..ce932cbd 100644 --- a/Ameba/Rule/Style/RedundantBegin.html +++ b/Ameba/Rule/Style/RedundantBegin.html @@ -979,7 +979,7 @@ - + ameba/rule/style/redundant_begin.cr @@ -1443,7 +1443,7 @@
@@ -1626,7 +1626,7 @@
diff --git a/Ameba/Rule/Style/RedundantNext.html b/Ameba/Rule/Style/RedundantNext.html index ea304800..94bd4c20 100644 --- a/Ameba/Rule/Style/RedundantNext.html +++ b/Ameba/Rule/Style/RedundantNext.html @@ -1014,7 +1014,7 @@ without arguments. Sometimes such statements are used to yild the nil - + ameba/rule/style/redundant_next.cr @@ -1538,7 +1538,7 @@ without arguments. Sometimes such statements are used to yild the nil @@ -1777,7 +1777,7 @@ without arguments. Sometimes such statements are used to yild the nil @@ -1793,7 +1793,7 @@ without arguments. Sometimes such statements are used to yild the nil diff --git a/Ameba/Rule/Style/RedundantReturn.html b/Ameba/Rule/Style/RedundantReturn.html index 96b90454..0b5ee11b 100644 --- a/Ameba/Rule/Style/RedundantReturn.html +++ b/Ameba/Rule/Style/RedundantReturn.html @@ -1011,7 +1011,7 @@ without arguments. Sometimes such returns are used to return the nil - + ameba/rule/style/redundant_return.cr @@ -1532,7 +1532,7 @@ without arguments. Sometimes such returns are used to return the nil @@ -1771,7 +1771,7 @@ without arguments. Sometimes such returns are used to return the nil @@ -1787,7 +1787,7 @@ without arguments. Sometimes such returns are used to return the nil diff --git a/Ameba/Rule/Style/UnlessElse.html b/Ameba/Rule/Style/UnlessElse.html index a14a13ee..de382c0c 100644 --- a/Ameba/Rule/Style/UnlessElse.html +++ b/Ameba/Rule/Style/UnlessElse.html @@ -967,7 +967,7 @@ an if, so the previous invalid example would become this:

- + ameba/rule/style/unless_else.cr @@ -1324,7 +1324,7 @@ an if, so the previous invalid example would become this:


@@ -1507,7 +1507,7 @@ an if, so the previous invalid example would become this:


diff --git a/Ameba/Rule/Style/VerboseBlock.html b/Ameba/Rule/Style/VerboseBlock.html index 4246fd1f..a42bc592 100644 --- a/Ameba/Rule/Style/VerboseBlock.html +++ b/Ameba/Rule/Style/VerboseBlock.html @@ -958,7 +958,7 @@ argument as a receiver, that can be collapsed into a short form.

- + ameba/rule/style/verbose_block.cr @@ -1476,7 +1476,7 @@ argument as a receiver, that can be collapsed into a short form.


@@ -1855,7 +1855,7 @@ argument as a receiver, that can be collapsed into a short form.


diff --git a/Ameba/Rule/Style/WhileTrue.html b/Ameba/Rule/Style/WhileTrue.html index 475f29f6..9ada8bae 100644 --- a/Ameba/Rule/Style/WhileTrue.html +++ b/Ameba/Rule/Style/WhileTrue.html @@ -954,7 +954,7 @@ - + ameba/rule/style/while_true.cr @@ -1298,7 +1298,7 @@
@@ -1481,7 +1481,7 @@
diff --git a/Ameba/Runner.html b/Ameba/Runner.html index 2addf063..6a50f8ea 100644 --- a/Ameba/Runner.html +++ b/Ameba/Runner.html @@ -931,7 +931,7 @@ runner.run.success? # => true or false
- + ameba/runner.cr @@ -1070,7 +1070,7 @@ config.formatter = formatter
@@ -1112,7 +1112,7 @@ runner.explain({file: file, line: l, column: c})

@@ -1139,7 +1139,7 @@ runner.run # => returns runner again

@@ -1160,7 +1160,7 @@ runner.run # => returns runner again

@@ -1185,7 +1185,7 @@ runner.success? # => true or false
diff --git a/Ameba/Runner/InfiniteCorrectionLoopError.html b/Ameba/Runner/InfiniteCorrectionLoopError.html index 3df1f7b4..e4572646 100644 --- a/Ameba/Runner/InfiniteCorrectionLoopError.html +++ b/Ameba/Runner/InfiniteCorrectionLoopError.html @@ -926,7 +926,7 @@ issues back and forth.

- + ameba/runner.cr @@ -1052,7 +1052,7 @@ issues back and forth.


diff --git a/Ameba/Severity.html b/Ameba/Severity.html index 951bcdd7..9c4f6c78 100644 --- a/Ameba/Severity.html +++ b/Ameba/Severity.html @@ -912,7 +912,7 @@ - + ameba/severity.cr @@ -1106,7 +1106,7 @@
@@ -1142,7 +1142,7 @@
@@ -1158,7 +1158,7 @@
@@ -1174,7 +1174,7 @@
@@ -1196,7 +1196,7 @@
@@ -1212,7 +1212,7 @@
diff --git a/Ameba/SeverityYamlConverter.html b/Ameba/SeverityYamlConverter.html index d94f7c38..190ddf33 100644 --- a/Ameba/SeverityYamlConverter.html +++ b/Ameba/SeverityYamlConverter.html @@ -925,7 +925,7 @@ - + ameba/severity.cr @@ -1019,7 +1019,7 @@
@@ -1035,7 +1035,7 @@
diff --git a/Ameba/Source.html b/Ameba/Source.html index 2a424930..3213e152 100644 --- a/Ameba/Source.html +++ b/Ameba/Source.html @@ -944,28 +944,28 @@ Has path, lines of code and issues reported by rules.

- + ameba/source.cr
- + ameba/source/corrector.cr
- + ameba/source/rewriter.cr
- + ameba/spec/support.cr @@ -1315,7 +1315,7 @@ Has path, lines of code and issues reported by rules.


@@ -1339,7 +1339,7 @@ Has path, lines of code and issues reported by rules.


@@ -1378,7 +1378,7 @@ source.ast
@@ -1399,7 +1399,7 @@ source.ast
@@ -1421,7 +1421,7 @@ Returns false if no issues were corrected.


@@ -1437,7 +1437,7 @@ Returns false if no issues were corrected.


@@ -1464,7 +1464,7 @@ source.lines # => ["a = 1", "b = 2"] @@ -1485,7 +1485,7 @@ source.lines # => ["a = 1", "b = 2"] @@ -1506,7 +1506,7 @@ source.lines # => ["a = 1", "b = 2"] @@ -1527,7 +1527,7 @@ source.lines # => ["a = 1", "b = 2"] @@ -1548,7 +1548,7 @@ source.lines # => ["a = 1", "b = 2"] diff --git a/Ameba/Source/Corrector.html b/Ameba/Source/Corrector.html index 1bc62a0a..fae0dd5a 100644 --- a/Ameba/Source/Corrector.html +++ b/Ameba/Source/Corrector.html @@ -926,7 +926,7 @@ on the different correction actions supplied.

- + ameba/source/corrector.cr @@ -1228,7 +1228,7 @@ on the different correction actions supplied.


@@ -1265,7 +1265,7 @@ on the different correction actions supplied.


@@ -1286,7 +1286,7 @@ on the different correction actions supplied.


@@ -1307,7 +1307,7 @@ on the different correction actions supplied.


@@ -1328,7 +1328,7 @@ on the different correction actions supplied.


@@ -1349,7 +1349,7 @@ on the different correction actions supplied.


@@ -1370,7 +1370,7 @@ on the different correction actions supplied.


@@ -1391,7 +1391,7 @@ on the different correction actions supplied.


@@ -1412,7 +1412,7 @@ on the different correction actions supplied.


@@ -1433,7 +1433,7 @@ on the different correction actions supplied.


@@ -1454,7 +1454,7 @@ on the different correction actions supplied.


@@ -1475,7 +1475,7 @@ on the different correction actions supplied.


@@ -1496,7 +1496,7 @@ on the different correction actions supplied.


@@ -1517,7 +1517,7 @@ on the different correction actions supplied.


@@ -1538,7 +1538,7 @@ on the different correction actions supplied.


@@ -1561,7 +1561,7 @@ overrun the end of the range.


@@ -1584,7 +1584,7 @@ overrun the end of the range.


@@ -1607,7 +1607,7 @@ overrun the end of the node.


@@ -1628,7 +1628,7 @@ overrun the end of the node.


@@ -1649,7 +1649,7 @@ overrun the end of the node.


@@ -1670,7 +1670,7 @@ overrun the end of the node.


@@ -1693,7 +1693,7 @@ overrun the beginning of the range.


@@ -1716,7 +1716,7 @@ overrun the beginning of the range.


@@ -1739,7 +1739,7 @@ overrun the beginning of the node.


@@ -1760,7 +1760,7 @@ overrun the beginning of the node.


@@ -1781,7 +1781,7 @@ overrun the beginning of the node.


@@ -1802,7 +1802,7 @@ overrun the beginning of the node.


@@ -1823,7 +1823,7 @@ overrun the beginning of the node.


@@ -1844,7 +1844,7 @@ overrun the beginning of the node.


@@ -1865,7 +1865,7 @@ overrun the beginning of the node.


diff --git a/Ameba/Source/Rewriter.html b/Ameba/Source/Rewriter.html index 135cd702..fdfc4cfd 100644 --- a/Ameba/Source/Rewriter.html +++ b/Ameba/Source/Rewriter.html @@ -996,14 +996,14 @@ and :hello, :world will be replaced by :hi.

- + ameba/source/rewriter.cr
- + ameba/source/rewriter/action.cr @@ -1170,7 +1170,7 @@ and :hello, :world will be replaced by :hi.


@@ -1202,7 +1202,7 @@ and :hello, :world will be replaced by :hi.


@@ -1223,7 +1223,7 @@ and :hello, :world will be replaced by :hi.


@@ -1244,7 +1244,7 @@ and :hello, :world will be replaced by :hi.


@@ -1265,7 +1265,7 @@ and :hello, :world will be replaced by :hi.


@@ -1286,7 +1286,7 @@ and :hello, :world will be replaced by :hi.


@@ -1307,7 +1307,7 @@ and :hello, :world will be replaced by :hi.


@@ -1328,7 +1328,7 @@ and :hello, :world will be replaced by :hi.


@@ -1349,7 +1349,7 @@ and :hello, :world will be replaced by :hi.


@@ -1370,7 +1370,7 @@ and :hello, :world will be replaced by :hi.


@@ -1391,7 +1391,7 @@ and :hello, :world will be replaced by :hi.


diff --git a/Ameba/Spec.html b/Ameba/Spec.html index 7172ef24..8b400f00 100644 --- a/Ameba/Spec.html +++ b/Ameba/Spec.html @@ -912,14 +912,14 @@ - + ameba/spec/annotated_source.cr
- + ameba/spec/be_valid.cr diff --git a/Ameba/Spec/AnnotatedSource.html b/Ameba/Spec/AnnotatedSource.html index 3c610a65..53cffd65 100644 --- a/Ameba/Spec/AnnotatedSource.html +++ b/Ameba/Spec/AnnotatedSource.html @@ -925,7 +925,7 @@ - + ameba/spec/annotated_source.cr @@ -1113,7 +1113,7 @@ text via View source] + [View source] @@ -1136,7 +1136,7 @@ text via View source] + [View source] @@ -1170,7 +1170,7 @@ code line number that each annotation corresponds to.


@@ -1209,7 +1209,7 @@ code line number that each annotation corresponds to.


@@ -1231,7 +1231,7 @@ The prefix is empty if the annotation is at the end of a code line.


@@ -1247,7 +1247,7 @@ The prefix is empty if the annotation is at the end of a code line.


@@ -1284,7 +1284,7 @@ source1.to_s == source2.to_s # => true
diff --git a/Ameba/Spec/BeValid.html b/Ameba/Spec/BeValid.html index 3c630773..abbc0df9 100644 --- a/Ameba/Spec/BeValid.html +++ b/Ameba/Spec/BeValid.html @@ -912,7 +912,7 @@ - + ameba/spec/be_valid.cr @@ -979,7 +979,7 @@
diff --git a/Ameba/Spec/BeValidExpectation.html b/Ameba/Spec/BeValidExpectation.html index 83ad639e..0535ea02 100644 --- a/Ameba/Spec/BeValidExpectation.html +++ b/Ameba/Spec/BeValidExpectation.html @@ -914,7 +914,7 @@ - + ameba/spec/be_valid.cr @@ -1046,7 +1046,7 @@
@@ -1078,7 +1078,7 @@
@@ -1094,7 +1094,7 @@
@@ -1110,7 +1110,7 @@
@@ -1126,7 +1126,7 @@
diff --git a/Ameba/Spec/ExpectIssue.html b/Ameba/Spec/ExpectIssue.html index 3dd63918..dab29a72 100644 --- a/Ameba/Spec/ExpectIssue.html +++ b/Ameba/Spec/ExpectIssue.html @@ -1014,7 +1014,7 @@ issue messages with [...]:

- + ameba/spec/expect_issue.cr @@ -1118,7 +1118,7 @@ issue messages with [...]:


@@ -1134,7 +1134,7 @@ issue messages with [...]:


@@ -1150,7 +1150,7 @@ issue messages with [...]:


@@ -1166,7 +1166,7 @@ issue messages with [...]:


diff --git a/Ameba/Spec/Util.html b/Ameba/Spec/Util.html index 332e96e0..b0d345ce 100644 --- a/Ameba/Spec/Util.html +++ b/Ameba/Spec/Util.html @@ -928,7 +928,7 @@ - + ameba/spec/util.cr @@ -995,7 +995,7 @@
diff --git a/Ameba/Tokenizer.html b/Ameba/Tokenizer.html index a17248ad..18614486 100644 --- a/Ameba/Tokenizer.html +++ b/Ameba/Tokenizer.html @@ -930,7 +930,7 @@ tokenizer.run do |token - + ameba/tokenizer.cr @@ -1052,7 +1052,7 @@ tokenizer.run do |token @@ -1075,7 +1075,7 @@ tokenizer.run do |token @@ -1115,7 +1115,7 @@ tokenizer.run do |token diff --git a/index.json b/index.json index 488535c4..97ac5610 100644 --- a/index.json +++ b/index.json @@ -1 +1 @@ -{"repository_name":"ameba","body":"

\n \n

Ameba

\n

Code style linter for Crystal

\n

\n \n (a single-celled animal that catches food and moves about by extending fingerlike projections of protoplasm)\n \n

\n

\n \n \n \n

\n

\n\n- [About](#about)\n- [Usage](#usage)\n - [Watch a tutorial](#watch-a-tutorial)\n - [Autocorrection](#autocorrection)\n - [Explain issues](#explain-issues)\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 - [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.....................FF....................................................................\n\nsrc/ameba/formatter/flycheck_formatter.cr:6:37\n[W] Lint/UnusedArgument: Unused argument `location`. If it's necessary, use `_` as an argument name to indicate that it won't be used.\n> source.issues.each do |issue, location|\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:14\n[W] Lint/UselessAssign: Useless assignment to variable `s`\n> return s += issues.size\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:7 [Correctable]\n[C] Style/RedundantReturn: Redundant `return` detected\n> return s += issues.size\n ^---------------------^\n\nFinished in 389.45 milliseconds\n107 inspected, 3 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### Autocorrection\n\nRules that are marked as `[Correctable]` in the output can be automatically corrected using `--fix` flag:\n\n```sh\n$ ameba --fix\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### Run in parallel\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```\n\nBuild `bin/ameba` binary within your project directory while running `shards install`.\n\n### OS X\n\n```sh\n$ brew tap crystal-ameba/ameba\n$ brew install ameba\n```\n\n### Docker\n\nBuild the image:\n\n```sh\n$ docker build -t ghcr.io/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 ghcr.io/crystal-ameba/ameba\n```\n\nAlso available on GitHub: https://github.com/crystal-ameba/ameba/pkgs/container/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### 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\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- [Sija](https://github.com/Sija) Sijawusz Pur Rahnama - contributor, maintainer\n","program":{"html_id":"ameba/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"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,"const":false,"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"}],"types":[{"html_id":"ameba/Ameba","path":"Ameba.html","kind":"module","full_name":"Ameba","name":"Ameba","abstract":false,"locations":[{"filename":"src/ameba.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba.cr#L26"},{"filename":"src/ameba/glob_utils.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/glob_utils.cr#L1"},{"filename":"src/ameba/inline_comments.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L1"},{"filename":"src/ameba/issue.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L1"},{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L3"},{"filename":"src/ameba/runner.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L1"},{"filename":"src/ameba/severity.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L3"},{"filename":"src/ameba/source.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/support.cr#L7"},{"filename":"src/ameba/tokenizer.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/ameba/ameba/src\\\"`).chomp.stringify }}"}],"extended_modules":[{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"}],"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.

","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.

","abstract":false,"args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"args_string":"(config = Config.load)","args_html":"(config = Config.load)","location":{"filename":"src/ameba.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba.cr#L40"},"def":{"name":"run","args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"visibility":"Public","body":"(Runner.new(config)).run"}}],"types":[{"html_id":"ameba/Ameba/AST","path":"Ameba/AST.html","kind":"module","full_name":"Ameba::AST","name":"AST","abstract":false,"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L3"},{"filename":"src/ameba/ast/branchable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L3"},{"filename":"src/ameba/ast/flow_expression.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L3"},{"filename":"src/ameba/ast/scope.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L3"},{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L2"},{"filename":"src/ameba/ast/variabling/argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L1"},{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L4"},{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L1"},{"filename":"src/ameba/ast/variabling/reference.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/reference.cr#L3"},{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L1"},{"filename":"src/ameba/ast/variabling/variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L1"},{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/flow_expression_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/scope_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","types":[{"html_id":"ameba/Ameba/AST/Argument","path":"Ameba/AST/Argument.html","kind":"class","full_name":"Ameba::AST::Argument","name":"Argument","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/variabling/argument.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the argument of some node.\nHolds the reference to the variable, thus to scope.\n\nFor example, all these vars are arguments:\n\n```\ndef method(a, b, c = 10, &block)\n 3.times do |i|\n end\n\n ->(x : Int32) {}\nend\n```","summary":"

Represents the argument of some node.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"visibility":"Public","body":"_ = allocate\n_.initialize(node, variable)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"anonymous?-instance-method","name":"anonymous?","doc":"Returns `true` if the `name` is empty, `false` otherwise.","summary":"

Returns true if the #name is empty, false otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L34"},"def":{"name":"anonymous?","visibility":"Public","body":"name.blank?"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L39"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L44"},"def":{"name":"name","visibility":"Public","body":"case current_node = node\nwhen Crystal::Var, 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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L17"},"def":{"name":"node","return_type":"Crystal::Var | Crystal::Arg","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L20"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::Variable,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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|Nil-instance-method","name":"branch","doc":"Branch of this assignment.","summary":"

Branch of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L57"},"def":{"name":"in_branch?","visibility":"Public","body":"!branch.nil?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L47"},"def":{"name":"op_assign?","visibility":"Public","body":"node.is_a?(Crystal::OpAssign)"}},{"html_id":"referenced=(referenced:Bool)-instance-method","name":"referenced=","abstract":false,"args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"args_string":"(referenced : Bool)","args_html":"(referenced : Bool)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced=","args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"visibility":"Public","body":"@referenced = referenced"}},{"html_id":"referenced?:Bool-instance-method","name":"referenced?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","visibility":"Public","body":"@referenced"}},{"html_id":"referenced_in_loop?-instance-method","name":"referenced_in_loop?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L37"},"def":{"name":"referenced_in_loop?","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L62"},"def":{"name":"target_node","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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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 assignment.","summary":"

Variable of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L14"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::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","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L18"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L24"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"true"}}]},{"html_id":"ameba/Ameba/AST/Branch","path":"Ameba/AST/Branch.html","kind":"class","full_name":"Ameba::AST::Branch","name":"Branch","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the branch in Crystal code.\nBranch is a part of a branchable statement.\nFor example, the branchable if statement contains 3 branches:\n\n```\nif a = something # --> Branch A\n a = 1 # --> Branch B\n put a if out # --> Branch C\nelse\n do_something a # --> Branch D\nend\n```","summary":"

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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branch.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L66"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::ASTNode, scope : Scope)","args_html":"(node : Crystal::ASTNode, scope : Scope)","location":{"filename":"src/ameba/ast/branch.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L57"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"of(node, scope.node)"}}],"constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Ameba::AST::Branchable)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","args_html":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","location":{"filename":"src/ameba/ast/branch.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L34"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_loop?-instance-method","name":"in_loop?","doc":"Returns `true` if current branch is in a loop, `false` - otherwise.\nFor example, this branch is in a loop:\n\n```\nwhile true\n handle_input # this branch is in a loop\n if wrong_input\n show_message # this branch is also in a loop.\n end\nend\n```","summary":"

Returns true if current branch is in a loop, false - otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/branch.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L48"},"def":{"name":"in_loop?","visibility":"Public","body":"@parent.loop?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L18"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L21"},"def":{"name":"parent","return_type":"Branchable","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/e6a5fa9/src/ameba/ast/branchable.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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```\nwhile 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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Nil|Ameba::AST::Branchable=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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","args_html":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"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":"Array of branches","summary":"

Array of branches

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L22"},"def":{"name":"branches","visibility":"Public","body":"@branches"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L41"},"def":{"name":"loop?","visibility":"Public","body":"(loop?(node)) || (!(!parent.try(&.loop?)))"}},{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual Crystal node","summary":"

The actual Crystal node

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"parent:Branchable|Nil-instance-method","name":"parent","doc":"Parent branchable (if any)","summary":"

Parent branchable (if any)

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L19"},"def":{"name":"parent","return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_COMPLEXITY","name":"DEFAULT_COMPLEXITY","value":"1"}],"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

","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","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L9"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L19"},"def":{"name":"count","visibility":"Public","body":"@scope.accept(self)\n@complexity\n"}},{"html_id":"macro_condition?:Bool-instance-method","name":"macro_condition?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L6"},"def":{"name":"macro_condition?","visibility":"Public","body":"@macro_condition"}},{"html_id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","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":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L45"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"visibility":"Public","body":"@macro_condition = true\n@complexity = DEFAULT_COMPLEXITY\nfalse\n"}}]},{"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/e6a5fa9/src/ameba/ast/flow_expression.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,in_loop:Bool)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"args_string":"(node : Crystal::ASTNode, in_loop : Bool)","args_html":"(node : Crystal::ASTNode, in_loop : Bool)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L50"},"def":{"name":"unreachable_nodes","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 = (!(loop?(exp))) && (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"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

"},{"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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::InstanceVar)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"node:Crystal::InstanceVar-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{Alias, Assign, Block, Call, Case, ClassDef, ClassVar, Def, EnumDef, ExceptionHandler, Expressions, HashLiteral, If, InstanceVar, IsA, LibDef, ModuleDef, MultiAssign, NilLiteral, StringInterpolation, Unless, Until, Var, When, While}","doc":"List of nodes to be visited by Ameba's rules.","summary":"

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

"}],"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```","summary":"

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

","class_methods":[{"html_id":"category_to_node_classes(category:Category)-class-method","name":"category_to_node_classes","abstract":false,"args":[{"name":"category","external_name":"category","restriction":"Category"}],"args_string":"(category : Category)","args_html":"(category : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L47"},"def":{"name":"category_to_node_classes","args":[{"name":"category","external_name":"category","restriction":"Category"}],"visibility":"Public","body":"([] of Crystal::ASTNode.class).tap do |classes|\n if category.macro?\n classes.push(Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor)\n end\nend"}}],"constructors":[{"html_id":"new(rule,source,*,skip:Category)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"args_string":"(rule, source, *, skip : Category)","args_html":"(rule, source, *, skip : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L58"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(rule,source,*,skip:Array|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"args_string":"(rule, source, *, skip : Array | Nil = nil)","args_html":"(rule, source, *, skip : Array | Nil = nil)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L63"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"visit(node:Crystal::VisibilityModifier)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"args_string":"(node : Crystal::VisibilityModifier)","args_html":"(node : Crystal::VisibilityModifier)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L68"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"visibility":"Public","body":"node.exp.visibility = node.modifier\ntrue\n"}},{"html_id":"visit(node:Crystal::Alias)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Alias` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Alias node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(node : Crystal::Alias)","args_html":"(node : Crystal::Alias)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Assign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Assign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Assign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(node : Crystal::Assign)","args_html":"(node : Crystal::Assign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Block)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Block` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Block node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(node : Crystal::Block)","args_html":"(node : Crystal::Block)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Call)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Call` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Call node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(node : Crystal::Call)","args_html":"(node : Crystal::Call)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Case)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Case` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Case node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(node : Crystal::Case)","args_html":"(node : Crystal::Case)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(node : Crystal::ClassDef)","args_html":"(node : Crystal::ClassDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(node : Crystal::ClassVar)","args_html":"(node : Crystal::ClassVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Def)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Def` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Def node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(node : Crystal::Def)","args_html":"(node : Crystal::Def)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::EnumDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::EnumDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::EnumDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(node : Crystal::EnumDef)","args_html":"(node : Crystal::EnumDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ExceptionHandler)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ExceptionHandler` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ExceptionHandler node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(node : Crystal::ExceptionHandler)","args_html":"(node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Expressions` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Expressions node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(node : Crystal::Expressions)","args_html":"(node : Crystal::Expressions)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::HashLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::HashLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::HashLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(node : Crystal::HashLiteral)","args_html":"(node : Crystal::HashLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::If)-instance-method","name":"visit","doc":"A visit callback for `Crystal::If` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::If node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"args_string":"(node : Crystal::If)","args_html":"(node : Crystal::If)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::InstanceVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::InstanceVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::InstanceVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::IsA)-instance-method","name":"visit","doc":"A visit callback for `Crystal::IsA` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::IsA node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(node : Crystal::IsA)","args_html":"(node : Crystal::IsA)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::LibDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::LibDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::LibDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(node : Crystal::LibDef)","args_html":"(node : Crystal::LibDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ModuleDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ModuleDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ModuleDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(node : Crystal::ModuleDef)","args_html":"(node : Crystal::ModuleDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::MultiAssign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::MultiAssign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::MultiAssign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(node : Crystal::MultiAssign)","args_html":"(node : Crystal::MultiAssign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::NilLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::NilLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::NilLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(node : Crystal::NilLiteral)","args_html":"(node : Crystal::NilLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::StringInterpolation)-instance-method","name":"visit","doc":"A visit callback for `Crystal::StringInterpolation` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::StringInterpolation node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(node : Crystal::StringInterpolation)","args_html":"(node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Unless)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Unless` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Unless node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(node : Crystal::Unless)","args_html":"(node : Crystal::Unless)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Until)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Until` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Until node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(node : Crystal::Until)","args_html":"(node : Crystal::Until)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Var)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Var` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Var node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(node : Crystal::Var)","args_html":"(node : Crystal::Var)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::When)-instance-method","name":"visit","doc":"A visit callback for `Crystal::When` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::When node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"args_string":"(node : Crystal::When)","args_html":"(node : Crystal::When)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::While)-instance-method","name":"visit","doc":"A visit callback for `Crystal::While` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::While node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(node : Crystal::While)","args_html":"(node : Crystal::While)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":86,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L86"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"!(skip?(node))"}}],"types":[{"html_id":"ameba/Ameba/AST/NodeVisitor/Category","path":"Ameba/AST/NodeVisitor/Category.html","kind":"enum","full_name":"Ameba::AST::NodeVisitor::Category","name":"Category","abstract":false,"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/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L12"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Macro","name":"Macro","value":"1"},{"id":"None","name":"None","value":"0"},{"id":"All","name":"All","value":"1"}],"namespace":{"html_id":"ameba/Ameba/AST/NodeVisitor","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor"},"instance_methods":[{"html_id":"macro?-instance-method","name":"macro?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L13"},"def":{"name":"macro?","visibility":"Public","body":"self.includes?(Macro)"}},{"html_id":"none?-instance-method","name":"none?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L12"},"def":{"name":"none?","visibility":"Public","body":"value == 0"}}]}]},{"html_id":"ameba/Ameba/AST/RedundantControlExpressionVisitor","path":"Ameba/AST/RedundantControlExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::RedundantControlExpressionVisitor","name":"RedundantControlExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A class that utilizes a logic to traverse AST nodes and\nfire a source test callback if a redundant `Crystal::ControlExpression`\nis reached.","summary":"

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

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::Source,node:Crystal::ASTNode)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L15"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"A node to run traversal on.","summary":"

A node to run traversal on.

","abstract":false,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"def":{"name":"source","return_type":"Source","visibility":"Public","body":"@source"}}]},{"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/e6a5fa9/src/ameba/ast/variabling/reference.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","instance_methods":[{"html_id":"explicit=(explicit:Bool)-instance-method","name":"explicit=","abstract":false,"args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"args_string":"(explicit : Bool)","args_html":"(explicit : Bool)","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit=","args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"visibility":"Public","body":"@explicit = explicit"}},{"html_id":"explicit?:Bool-instance-method","name":"explicit?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit?","visibility":"Public","body":"@explicit"}}]},{"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/e6a5fa9/src/ameba/ast/scope.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,outer_scope:Nil|Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","args_html":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L47"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"add_argument(node)-instance-method","name":"add_argument","doc":"Creates a new argument in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_argument(arg_node)\n```","summary":"

Creates a new argument in the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L67"},"def":{"name":"add_argument","args":[{"name":"node","external_name":"node","restriction":""}],"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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L78"},"def":{"name":"add_ivariable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"ivariables << (InstanceVariable.new(node))"}},{"html_id":"add_type_dec_variable(node)-instance-method","name":"add_type_dec_variable","doc":"Adds a new type declaration variable to the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_type_dec_variable(node)\n```","summary":"

Adds a new type declaration variable to the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":88,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L88"},"def":{"name":"add_type_dec_variable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"type_dec_variables << (TypeDecVariable.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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L57"},"def":{"name":"add_variable","args":[{"name":"node","external_name":"node","restriction":""}],"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` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"var","external_name":"var","restriction":""}],"args_string":"(var)","args_html":"(var)","location":{"filename":"src/ameba/ast/scope.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L199"},"def":{"name":"arg?","args":[{"name":"var","external_name":"var","restriction":""}],"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L20"},"def":{"name":"arguments","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","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"args_string":"(name, node)","args_html":"(name, node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":109,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L109"},"def":{"name":"assign_variable","args":[{"name":"name","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(find_variable(name)).try(&.assign(node, self))"}},{"html_id":"assigns_ivar?(name)-instance-method","name":"assigns_ivar?","doc":"Returns `true` if instance variable is assigned in this scope.","summary":"

Returns true if instance variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":140,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L140"},"def":{"name":"assigns_ivar?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"arguments.any?() do |__arg7|\n __arg7.name == name\nend && ivariables.any?() do |__arg8|\n __arg8.name == \"@#{name}\"\nend"}},{"html_id":"assigns_type_dec?(name)-instance-method","name":"assigns_type_dec?","doc":"Returns `true` if type declaration variable is assigned in this scope.","summary":"

Returns true if type declaration variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L146"},"def":{"name":"assigns_type_dec?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"type_dec_variables.any?() do |__arg9|\n __arg9.name == name\nend || (!(!outer_scope.try(&.assigns_type_dec?(name))))"}},{"html_id":"block?-instance-method","name":"block?","doc":"Returns `true` if current scope represents a block (or proc),\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L115"},"def":{"name":"block?","visibility":"Public","body":"node.is_a?(Crystal::Block) || node.is_a?(Crystal::ProcLiteral)"}},{"html_id":"class_def?(*,check_outer_scopes=false)-instance-method","name":"class_def?","doc":"Returns `true` if current scope is a class def, `false` otherwise.","summary":"

Returns true if current scope is a class def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"class_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ClassDef) || (!(!(check_outer_scopes && outer_scope.try(&.class_def?(check_outer_scopes: true)))))"}},{"html_id":"def?(*,check_outer_scopes=false)-instance-method","name":"def?","doc":"Returns `true` if current scope is a def, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::Def) || (!(!(check_outer_scopes && outer_scope.try(&.def?(check_outer_scopes: true)))))"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enum_def?(*,check_outer_scopes=false)-instance-method","name":"enum_def?","doc":"Returns `true` if current scope is a enum def, `false` otherwise.","summary":"

Returns true if current scope is a enum def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"enum_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::EnumDef) || (!(!(check_outer_scopes && outer_scope.try(&.enum_def?(check_outer_scopes: true)))))"}},{"html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns `true` if the *node* represents exactly\nthe same Crystal node as `@node`.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":218,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L218"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node == @node) && node.location) && (node.location == @node.location)"}},{"html_id":"find_variable(name:String)-instance-method","name":"find_variable","doc":"Returns variable by its name or `nil` if it does not exist.\n\n```\nscope = Scope.new(class_node, nil)\nscope.find_variable(\"foo\")\n```","summary":"

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

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/ast/scope.cr","line_number":98,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L98"},"def":{"name":"find_variable","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"variables.find() do |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"fun_def?(*,check_outer_scopes=false)-instance-method","name":"fun_def?","doc":"Returns `true` if current scope is a fun def, `false` otherwise.","summary":"

Returns true if current scope is a fun def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"fun_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::FunDef) || (!(!(check_outer_scopes && outer_scope.try(&.fun_def?(check_outer_scopes: true)))))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_macro?-instance-method","name":"in_macro?","doc":"Returns `true` if current scope sits inside a macro.","summary":"

Returns true if current scope sits inside a macro.

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":132,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L132"},"def":{"name":"in_macro?","visibility":"Public","body":"((node.is_a?(Crystal::Macro) || node.is_a?(Crystal::MacroIf)) || node.is_a?(Crystal::MacroFor)) || (!(!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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L32"},"def":{"name":"inner_scopes","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L23"},"def":{"name":"ivariables","visibility":"Public","body":"@ivariables"}},{"html_id":"lib_def?(*,check_outer_scopes=false)-instance-method","name":"lib_def?","doc":"Returns `true` if current scope is a lib def, `false` otherwise.","summary":"

Returns true if current scope is a lib def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"lib_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::LibDef) || (!(!(check_outer_scopes && outer_scope.try(&.lib_def?(check_outer_scopes: true)))))"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"module_def?(*,check_outer_scopes=false)-instance-method","name":"module_def?","doc":"Returns `true` if current scope is a module def, `false` otherwise.","summary":"

Returns true if current scope is a module def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"module_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ModuleDef) || (!(!(check_outer_scopes && outer_scope.try(&.module_def?(check_outer_scopes: true)))))"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L35"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"outer_scope:Scope|Nil-instance-method","name":"outer_scope","doc":"Link to the outer scope","summary":"

Link to the outer scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L29"},"def":{"name":"outer_scope","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L17"},"def":{"name":"references","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,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","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":165,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L165"},"def":{"name":"references?","args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"variable.references.any? do |reference|\n (reference.scope == self) || (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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":127,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L127"},"def":{"name":"spawn_block?","visibility":"Public","body":"(node.as?(Crystal::Block)).try(&.call).try(&.name) == \"spawn\""}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":194,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L194"},"def":{"name":"top_level?","visibility":"Public","body":"outer_scope.nil?"}},{"html_id":"type_dec_variables:Array(Ameba::AST::TypeDecVariable)-instance-method","name":"type_dec_variables","doc":"Link to the type declaration variables used in current scope","summary":"

Link to the type declaration variables used in current scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L26"},"def":{"name":"type_dec_variables","visibility":"Public","body":"@type_dec_variables"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":153,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L153"},"def":{"name":"type_definition?","visibility":"Public","body":"(((((node.is_a?(Crystal::ClassDef) || node.is_a?(Crystal::ModuleDef)) || node.is_a?(Crystal::EnumDef)) || 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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L14"},"def":{"name":"variables","visibility":"Public","body":"@variables"}},{"html_id":"visibility-instance-method","name":"visibility","doc":"Returns visibility of the current scope (could be inherited from the outer scope).","summary":"

Returns visibility of the current scope (could be inherited from the outer scope).

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":179,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L179"},"def":{"name":"visibility","visibility":"Public","body":"@visibility || outer_scope.try(&.visibility)"}},{"html_id":"visibility=(visibility:Crystal::Visibility|Nil)-instance-method","name":"visibility=","doc":"Scope visibility level","summary":"

Scope visibility level

","abstract":false,"args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"args_string":"(visibility : Crystal::Visibility | Nil)","args_html":"(visibility : Crystal::Visibility | Nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L11"},"def":{"name":"visibility=","args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"visibility":"Public","body":"@visibility = visibility"}},{"html_id":"yields=(yields:Bool)-instance-method","name":"yields=","doc":"Whether the scope yields.","summary":"

Whether the scope yields.

","abstract":false,"args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"args_string":"(yields : Bool)","args_html":"(yields : Bool)","location":{"filename":"src/ameba/ast/scope.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L8"},"def":{"name":"yields=","args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"visibility":"Public","body":"@yields = yields"}},{"html_id":"yields?(check_inner_scopes=true)-instance-method","name":"yields?","doc":"Returns `true` if current scope (or any of inner scopes) yields,\n`false` otherwise.","summary":"

Returns true if current scope (or any of inner scopes) yields, false otherwise.

","abstract":false,"args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(check_inner_scopes = true)","args_html":"(check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L174"},"def":{"name":"yields?","args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"@yields || (check_inner_scopes && inner_scopes.any?(&.yields?))"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{ClassDef, ModuleDef, EnumDef, LibDef, FunDef, TypeDef, TypeOf, CStructOrUnionDef, ProcLiteral, Block, Macro, MacroIf, MacroFor}","doc":"Non-exhaustive list of nodes to be visited by Ameba's rules.","summary":"

Non-exhaustive list of nodes to be visited by Ameba's rules.

"},{"id":"SPECIAL_NODE_NAMES","name":"SPECIAL_NODE_NAMES","value":"[\"super\", \"previous_def\"] of ::String"}],"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.

","constructors":[{"html_id":"new(rule,source,skip=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","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/scope_visitor.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/scope_visitor.cr#L31"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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","abstract":false,"location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is `Crystal::Expressions`,\nthen always traverse the children.","summary":"

If a top level node is Crystal::Expressions, then always traverse the children.

","abstract":false,"args":[{"name":"node","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L20"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L26"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"false"}}]},{"html_id":"ameba/Ameba/AST/TypeDecVariable","path":"Ameba/AST/TypeDecVariable.html","kind":"class","full_name":"Ameba::AST::TypeDecVariable","name":"TypeDecVariable","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/type_dec_variable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::TypeDeclaration)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"args_string":"(node : Crystal::TypeDeclaration)","args_html":"(node : Crystal::TypeDeclaration)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name-instance-method","name":"name","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L11"},"def":{"name":"name","visibility":"Public","body":"case var = @node.var\nwhen Crystal::Var, Crystal::InstanceVar, Crystal::ClassVar, Crystal::Global\n var.name\nelse\n raise(\"Unsupported var node type: #{var.class}\")\nend"}},{"html_id":"node:Crystal::TypeDeclaration-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L3"},"def":{"name":"node","return_type":"Crystal::TypeDeclaration","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"html_id":"ameba/Ameba/AST/Util","path":"Ameba/AST/Util.html","kind":"module","full_name":"Ameba::AST::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/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/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"}],"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.

","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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L180"},"def":{"name":"abort?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"abort\")) && node.args.size <= 2) && node.obj.nil?"}},{"html_id":"control_exp_code(node:Crystal::ControlExpression,code_lines)-instance-method","name":"control_exp_code","doc":"Returns the exp code of a control expression.\nWraps implicit tuple literal with curly brackets (e.g. multi-return).","summary":"

Returns the exp code of a control expression.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node : Crystal::ControlExpression, code_lines)","args_html":"(node : Crystal::ControlExpression, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L199"},"def":{"name":"control_exp_code","args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"visibility":"Public","body":"if exp = node.exp\nelse\n return\nend\nif exp_code = node_source(exp, code_lines)\nelse\n return\nend\nif exp.is_a?(Crystal::TupleLiteral) && (exp_code[0] != '{')\nelse\n return exp_code\nend\nif exp_start = exp.elements.first.location\nelse\n return\nend\nif exp_end = exp.end_location\nelse\n return\nend\n\"{#{source_between(exp_start, exp_end, code_lines)}}\"\n"}},{"html_id":"dynamic_literal?(node):Bool-instance-method","name":"dynamic_literal?","doc":"Returns `true` if current `node` is a dynamic literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L48"},"def":{"name":"dynamic_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && (!is_static)\n"}},{"html_id":"exit?(node)-instance-method","name":"exit?","doc":"Returns `true` if node represents `exit` method call.","summary":"

Returns true if node represents exit method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L174"},"def":{"name":"exit?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"exit\")) && node.args.size <= 1) && node.obj.nil?"}},{"html_id":"flow_command?(node,in_loop)-instance-method","name":"flow_command?","doc":"Returns `true` if node is a flow command, `false` otherwise.\nNode represents a flow command if it is a control expression,\nor special call node that interrupts execution (i.e. raise, exit, abort).","summary":"

Returns true if node is a flow command, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/util.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L102"},"def":{"name":"flow_command?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"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","external_name":"node","restriction":""},{"name":"in_loop","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":140,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L140"},"def":{"name":"flow_expression?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","default_value":"false","external_name":"in_loop","restriction":""}],"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):Bool-instance-method","name":"literal?","doc":"Returns `true` if current `node` is a literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L54"},"def":{"name":"literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, _ = literal_kind?(node)\nis_literal\n"}},{"html_id":"loop?(node)-instance-method","name":"loop?","doc":"Returns `true` if node represents a loop.","summary":"

Returns true if node represents a loop.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":186,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L186"},"def":{"name":"loop?","args":[{"name":"node","external_name":"node","restriction":""}],"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":"name_end_location(node)-instance-method","name":"name_end_location","doc":"Returns `nil` if *node* does not contain a name.\n\nNOTE: Use this instead of `Crystal::Call#name_end_location` to avoid an\n off-by-one error.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":242,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L242"},"def":{"name":"name_end_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = name_location(node)\nelse\n return\nend\nif (size = name_size(node)).zero?\n return\nend\nloc.adjust(column_number: size - 1)\n"}},{"html_id":"name_location(node)-instance-method","name":"name_location","doc":"Returns `nil` if *node* does not contain a name.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":210,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L210"},"def":{"name":"name_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = node.name_location\n return loc\nend\nif node.is_a?(Crystal::TypeDeclaration) || node.is_a?(Crystal::UninitializedVar)\n return node.var.location\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return\nend\nif name.is_a?(Crystal::ASTNode)\nelse\n return\nend\nname.location\n"}},{"html_id":"name_size(node)-instance-method","name":"name_size","doc":"Returns zero if *node* does not contain a name.","summary":"

Returns zero if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":224,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L224"},"def":{"name":"name_size","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if (size = node.name_size).zero?\nelse\n return size\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return 0\nend\ncase name\nwhen Crystal::ASTNode\n name.name_size\nwhen Crystal::Token::Kind\n name.to_s.size\nelse\n name.size\nend\n"}},{"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","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node, code_lines)","args_html":"(node, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L69"},"def":{"name":"node_source","args":[{"name":"node","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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":"path_named?(node,name):Bool-instance-method","name":"path_named?","doc":"Returns `true` if current `node` is a `Crystal::Path`\nmatching given *name*, `false` otherwise.","summary":"

Returns true if current node is a Crystal::Path matching given name, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"args_string":"(node, name) : Bool","args_html":"(node, name) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L61"},"def":{"name":"path_named?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"return_type":"Bool","visibility":"Public","body":"node.is_a?(Crystal::Path) && (name == (node.names.join(\"::\")))"}},{"html_id":"raise?(node)-instance-method","name":"raise?","doc":"Returns `true` if node represents `raise` method call.","summary":"

Returns true if node represents raise method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":168,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L168"},"def":{"name":"raise?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"raise\")) && (node.args.size == 1)) && node.obj.nil?"}},{"html_id":"source_between(loc,end_loc,code_lines):String|Nil-instance-method","name":"source_between","doc":"Returns the source code from *loc* to *end_loc* (inclusive).","summary":"

Returns the source code from loc to end_loc (inclusive).

","abstract":false,"args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String | Nil","args_html":"(loc, end_loc, code_lines) : String | Nil","location":{"filename":"src/ameba/ast/util.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L77"},"def":{"name":"source_between","args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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"}},{"html_id":"static_literal?(node):Bool-instance-method","name":"static_literal?","doc":"Returns `true` if current `node` is a static literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L42"},"def":{"name":"static_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && is_static\n"}}]},{"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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/AST/Reference","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference"}],"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 assignments.","summary":"

Represents the existence of the local variable.

","constructors":[{"html_id":"new(node:Crystal::Var,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::Var, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::Var, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L28"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L45"},"def":{"name":"assign","args":[{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"visibility":"Public","body":"assignments << (Assignment.new(node, self, scope))\nupdate_assign_reference!\n"}},{"html_id":"assign_before_reference:Crystal::ASTNode|Nil-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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L18"},"def":{"name":"assign_before_reference","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 assignments of this variable.","summary":"

List of the assignments of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","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","default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":114,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L114"},"def":{"name":"captured_by_block?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":163,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L163"},"def":{"name":"declared_before?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"var_location, node_location = location, node.location\nif var_location && node_location\nelse\n return\nend\n(var_location.line_number < node_location.line_number) || ((var_location.line_number == node_location.line_number) && var_location.column_number < node_location.column_number)\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L156"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(node.is_a?(Crystal::Var) && (node.name == @node.name)) && (node.location == @node.location)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":150,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L150"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","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","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","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":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L68"},"def":{"name":"reference","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"(Reference.new(node, scope)).tap do |reference|\n references << reference\n scope.references << reference\nend"}},{"html_id":"reference(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":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(scope : Scope)","args_html":"(scope : Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L76"},"def":{"name":"reference","args":[{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"reference(node, scope)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L87"},"def":{"name":"reference_assignments!","visibility":"Public","body":"consumed_branches = Set(Branch).new\nassignments.reverse_each do |assignment|\n if assignment.branch.in?(consumed_branches)\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, some_scope)\nvariable.referenced? # => true\n```","summary":"

Returns true if variable has any reference.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L58"},"def":{"name":"referenced?","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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","visibility":"Public","body":"@references"}},{"html_id":"scope:Scope-instance-method","name":"scope","doc":"Scope of this variable.","summary":"

Scope of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","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 $?.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L32"},"def":{"name":"special?","visibility":"Public","body":"@node.special_var?"}},{"html_id":"target_of?(assign)-instance-method","name":"target_of?","doc":"Returns `true` if the variable is a target (on the left) of the assignment,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"assign","external_name":"assign","restriction":""}],"args_string":"(assign)","args_html":"(assign)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":138,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L138"},"def":{"name":"target_of?","args":[{"name":"assign","external_name":"assign","restriction":""}],"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 |target|\n eql?(target)\n end\nwhen Crystal::UninitializedVar\n eql?(assign.var)\nelse\n false\nend"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` if not.","summary":"

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

","abstract":false,"args":[{"name":"scope","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":126,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L126"},"def":{"name":"used_in_macro?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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"}}]}]},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L37"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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}"},{"id":"DEFAULT_GLOBS","name":"DEFAULT_GLOBS","value":"[\"**/*.cr\", \"!lib\"] of ::String"},{"id":"DEFAULT_PATH","name":"DEFAULT_PATH","value":"Path[Dir.current] / FILENAME"},{"id":"DEFAULT_PATHS","name":"DEFAULT_PATHS","value":"{Path[\"~\"] / FILENAME, Path[XDG_CONFIG_HOME] / \"ameba/config.yml\"}"},{"id":"FILENAME","name":"FILENAME","value":"\".ameba.yml\""},{"id":"XDG_CONFIG_HOME","name":"XDG_CONFIG_HOME","value":"ENV.fetch(\"XDG_CONFIG_HOME\", \"~/.config\")"}],"included_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"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 located in a current\nworking directory.\n\nIf it cannot be found until reaching the root directory, then it will be\nsearched for in the user’s global config locations, which consists of a\ndotfile or a config file inside the XDG Base Directory specification.\n\n- `~/.ameba.yml`\n- `$XDG_CONFIG_HOME/ameba/config.yml` (expands to `~/.config/ameba/config.yml`\n if `$XDG_CONFIG_HOME` is not set)\n\nIf both files exist, the dotfile will be selected.\n\nAs an example, if Ameba is invoked from inside `/path/to/project/lib/utils`,\nthen it will use the config as specified inside the first of the following files:\n\n- `/path/to/project/lib/utils/.ameba.yml`\n- `/path/to/project/lib/.ameba.yml`\n- `/path/to/project/.ameba.yml`\n- `/path/to/.ameba.yml`\n- `/path/.ameba.yml`\n- `/.ameba.yml`\n- `~/.ameba.yml`\n- `~/.config/ameba/config.yml`","summary":"

A configuration entry for Ameba::Runner.

","class_methods":[{"html_id":"formatter_names-class-method","name":"formatter_names","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":145,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L145"},"def":{"name":"formatter_names","visibility":"Public","body":"AVAILABLE_FORMATTERS.keys.join('|')"}},{"html_id":"load(path=nil,colors=true,skip_reading_config=false)-class-method","name":"load","doc":"Loads YAML configuration file by `path`.\n\n```\nconfig = Ameba::Config.load\n```","summary":"

Loads YAML configuration file by path.

","abstract":false,"args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"args_string":"(path = nil, colors = true, skip_reading_config = false)","args_html":"(path = nil, colors = true, skip_reading_config = false)","location":{"filename":"src/ameba/config.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L110"},"def":{"name":"load","args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"visibility":"Public","body":"begin\n Colorize.enabled = colors\n content = if skip_reading_config\n \"{}\"\n else\n (read_config(path)) || \"{}\"\n end\n Config.new(YAML.parse(content))\nrescue e\n raise(\"Unable to load config file: #{e.message}\")\nend"}}],"instance_methods":[{"html_id":"autocorrect=(autocorrect:Bool)-instance-method","name":"autocorrect=","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"args_string":"(autocorrect : Bool)","args_html":"(autocorrect : Bool)","location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L87"},"def":{"name":"autocorrect=","args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"visibility":"Public","body":"@autocorrect = autocorrect"}},{"html_id":"autocorrect?:Bool-instance-method","name":"autocorrect?","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L87"},"def":{"name":"autocorrect?","visibility":"Public","body":"@autocorrect"}},{"html_id":"excluded:Array(String)-instance-method","name":"excluded","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L84"},"def":{"name":"excluded","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","external_name":"excluded","restriction":"Array(String)"}],"args_string":"(excluded : Array(String))","args_html":"(excluded : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L84"},"def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String)"}],"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L171"},"def":{"name":"formatter","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","external_name":"name","restriction":"String | Symbol"}],"args_string":"(name : String | Symbol)","args_html":"(name : String | Symbol)","location":{"filename":"src/ameba/config.cr","line_number":181,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L181"},"def":{"name":"formatter=","args":[{"name":"name","external_name":"name","restriction":"String | Symbol"}],"visibility":"Public","body":"if formatter = AVAILABLE_FORMATTERS[name]?\nelse\n raise(\"Unknown formatter `#{name}`. Use one of #{Config.formatter_names}.\")\nend\n@formatter = formatter.new\n"}},{"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L171"},"def":{"name":"formatter=","args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L75"},"def":{"name":"globs","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","external_name":"globs","restriction":"Array(String)"}],"args_string":"(globs : Array(String))","args_html":"(globs : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L75"},"def":{"name":"globs=","args":[{"name":"globs","external_name":"globs","restriction":"Array(String)"}],"visibility":"Public","body":"@globs = globs"}},{"html_id":"rules:Array(Rule::Base)-instance-method","name":"rules","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L63"},"def":{"name":"rules","return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L64"},"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L64"},"def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L158"},"def":{"name":"sources","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","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":194,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L194"},"def":{"name":"update_rule","args":[{"name":"name","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L215"},"def":{"name":"update_rules","args":[{"name":"names","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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)"}}]},{"html_id":"ameba/Ameba/Ext","path":"Ameba/Ext.html","kind":"module","full_name":"Ameba::Ext","name":"Ext","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Ext/Location","path":"Ameba/Ext/Location.html","kind":"module","full_name":"Ameba::Ext::Location","name":"Location","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"ameba/Crystal/Location","kind":"class","full_name":"Crystal::Location","name":"Location"}],"namespace":{"html_id":"ameba/Ameba/Ext","kind":"module","full_name":"Ameba::Ext","name":"Ext"},"doc":"Extensions to Crystal::Location","summary":"

Extensions to Crystal::Location

","instance_methods":[{"html_id":"adjust(line_number=0,column_number=0):self-instance-method","name":"adjust","doc":"Returns the same location as this location but with the line and/or column number(s) adjusted\nby the given amount(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) adjusted by the given amount(s).

","abstract":false,"args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"args_string":"(line_number = 0, column_number = 0) : self","args_html":"(line_number = 0, column_number = 0) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L11"},"def":{"name":"adjust","args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, @line_number + line_number, @column_number + column_number)"}},{"html_id":"seek(offset:self):self-instance-method","name":"seek","doc":"Seeks to a given *offset* relative to `self`.","summary":"

Seeks to a given offset relative to self.

","abstract":false,"args":[{"name":"offset","external_name":"offset","restriction":"self"}],"args_string":"(offset : self) : self","args_html":"(offset : self) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L16"},"def":{"name":"seek","args":[{"name":"offset","external_name":"offset","restriction":"self"}],"return_type":"self","visibility":"Public","body":"if (offset.filename.as?(String)).presence && (@filename != offset.filename)\n raise(ArgumentError.new(\"Mismatching filenames:\\n #{@filename}\\n #{offset.filename}\"))\nend\nif offset.line_number == 1\n self.class.new(@filename, @line_number, (@column_number + offset.column_number) - 1)\nelse\n self.class.new(@filename, (@line_number + offset.line_number) - 1, offset.column_number)\nend\n"}},{"html_id":"with(line_number=@line_number,column_number=@column_number):self-instance-method","name":"with","doc":"Returns the same location as this location but with the line and/or column number(s) changed\nto the given value(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) changed to the given value(s).

","abstract":false,"args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"args_string":"(line_number = @line_number, column_number = @column_number) : self","args_html":"(line_number = @line_number, column_number = @column_number) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L5"},"def":{"name":"with","args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, line_number, column_number)"}}]}]},{"html_id":"ameba/Ameba/Formatter","path":"Ameba/Formatter.html","kind":"module","full_name":"Ameba::Formatter","name":"Formatter","abstract":false,"locations":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/base_formatter.cr#L13"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","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","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L30"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/base_formatter.cr#L10"},"def":{"name":"output","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","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L26"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":""}},{"html_id":"source_started(source:Source)-instance-method","name":"source_started","doc":"Callback that indicates when source inspection is started.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is started.

","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L22"},"def":{"name":"source_started","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L18"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":""}}]},{"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/e6a5fa9/src/ameba/formatter/disabled_formatter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/e6a5fa9/src/ameba/formatter/disabled_formatter.cr#L4"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"output << \"Disabled rules using inline directives:\\n\\n\"\nsources.each do |source|\n source.issues.select(&.disabled?).each do |issue|\n if loc = issue.location\n else\n next\n end\n output << (\"#{source.path}:#{loc.line_number}\".colorize(:cyan))\n output << \" #{issue.rule.name}\\n\"\n end\nend\n"}}]},{"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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"subclasses":[{"html_id":"ameba/Ameba/Formatter/TODOFormatter","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter"}],"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.

","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","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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L27"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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.print(location.colorize(:cyan))\n if issue.correctable?\n if config[:autocorrect]?\n output.print(\" [Corrected]\".colorize(:green))\n else\n output.print(\" [Correctable]\".colorize(:yellow))\n end\n end\n output.puts\n output.puts((\"[%s] %s: %s\" % {issue.rule.severity.symbol, issue.rule.name, issue.message}).colorize(issue.rule.severity.color))\n if show_affected_code && (code = affected_code(issue))\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","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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L21"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L13"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@started_at = Time.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\n"}}]},{"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/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(output:IO,location)-class-method","name":"new","doc":"Creates a new instance of `ExplainFormatter`.\n\nAccepts *output* which indicates the io where the explanation will be written to.\nSecond argument is *location* which indicates the location to explain.\n\n```\nExplainFormatter.new output, {\n file: path,\n line: line_number,\n column: column_number,\n}\n```","summary":"

Creates a new instance of ExplainFormatter.

","abstract":false,"args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"args_string":"(output : IO, location)","args_html":"(output : IO, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L24"},"def":{"name":"new","args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"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 explanations at the *@location*.","summary":"

Reports the explanations at the @location.

","abstract":false,"args":[{"name":"sources","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L33"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L10"},"def":{"name":"location","return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L9"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"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/e6a5fa9/src/ameba/formatter/flycheck_formatter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"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","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/e6a5fa9/src/ameba/formatter/flycheck_formatter.cr#L5"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n if loc = issue.location\n else\n next\n end\n @mutex.synchronize do\n output.printf(\"%s:%d:%d: %s: [%s] %s\\n\", source.path, loc.line_number, loc.column_number, issue.rule.severity.symbol, issue.rule.name, issue.message.gsub('\\n', \" \"))\n end\nend"}}]},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L65"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

A formatter that produces the result in a json format.

","constructors":[{"html_id":"new(output=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","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":66,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L66"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":94,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L94"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L74"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"json_source = AsJSON::Source.new(source.path)\nsource.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n json_source.issues << (AsJSON::Issue.new(issue.rule.name, issue.rule.severity.to_s, issue.location, issue.end_location, issue.message))\n __temp_54 = @result.summary\n __temp_54.issues_count = __temp_54.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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L70"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@result.summary.target_sources_count = sources.size"}}]},{"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/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(output=STDOUT,config_path:Path=Config::DEFAULT_PATH)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"args_string":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","args_html":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L6"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output, config_path)\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","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/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L9"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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\n(generate_todo_config(issues)).tap do |file|\n @output.puts(\"Created #{file.path}\")\nend\n"}}]},{"html_id":"ameba/Ameba/Formatter/Util","path":"Ameba/Formatter/Util.html","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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"},"instance_methods":[{"html_id":"affected_code(issue:Issue,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L45"},"def":{"name":"affected_code","args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"if location = issue.location\nelse\n return\nend\naffected_code(issue.code, location, issue.end_location, context_lines, max_length, ellipsis, prompt)\n"}},{"html_id":"affected_code(code,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L51"},"def":{"name":"affected_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"lines = code.split('\\n')\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","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","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":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L19"},"def":{"name":"context","args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","default_value":"true","external_name":"remove_empty","restriction":""}],"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|Nil):String|Nil-instance-method","name":"deansify","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String | Nil) : String | Nil","args_html":"(message : String | Nil) : String | Nil","location":{"filename":"src/ameba/formatter/util.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L5"},"def":{"name":"deansify","args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"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","abstract":false,"args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L9"},"def":{"name":"trim","args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"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"}}]}]},{"html_id":"ameba/Ameba/GlobUtils","path":"Ameba/GlobUtils.html","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils","abstract":false,"locations":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/glob_utils.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/e6a5fa9/src/ameba/glob_utils.cr#L22"},"def":{"name":"expand","args":[{"name":"globs","external_name":"globs","restriction":""}],"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","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/e6a5fa9/src/ameba/glob_utils.cr#L10"},"def":{"name":"find_files_by_globs","args":[{"name":"globs","external_name":"globs","restriction":""}],"visibility":"Public","body":"rejected = rejected_globs(globs)\nselected = globs - rejected\n(expand(selected)) - (expand(rejected.map!(&.[](1..-1))))\n"}}]},{"html_id":"ameba/Ameba/InlineComments","path":"Ameba/InlineComments.html","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments","abstract":false,"locations":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COMMENT_DIRECTIVE_REGEX","name":"COMMENT_DIRECTIVE_REGEX","value":"/# ameba:(?\\w+) (?\\w+(?:\\/\\w+)?(?:,? \\w+(?:\\/\\w+)?)*)/"}],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes inline comments parsing and processing logic.","summary":"

A module that utilizes inline comments parsing and processing logic.

","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.

","abstract":false,"args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"args_string":"(line_number : Int32)","args_html":"(line_number : Int32)","location":{"filename":"src/ameba/inline_comments.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L78"},"def":{"name":"comment?","args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"visibility":"Public","body":"if line = lines[line_number]?\nelse\n return\nend\ncomment?(line)\n"}},{"html_id":"location_disabled?(location:Crystal::Location|Nil,rule)-instance-method","name":"location_disabled?","doc":"Returns `true` if current location is disabled for a particular rule,\n`false` otherwise.\n\nLocation is disabled in two cases:\n 1. The line of the location ends with a comment directive.\n 2. The line above the location is a comment directive.\n\nFor example, here are two examples of disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\nTime.epoch(1483859302)\n\nTime.epoch(1483859302) # ameba:disable Style/LargeNumbers\n```\n\nBut here are examples which are not considered as disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\n#\nTime.epoch(1483859302)\n\nif use_epoch? # ameba:disable Style/LargeNumbers\n Time.epoch(1483859302)\nend\n```","summary":"

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

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(location : Crystal::Location | Nil, rule)","args_html":"(location : Crystal::Location | Nil, rule)","location":{"filename":"src/ameba/inline_comments.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L40"},"def":{"name":"location_disabled?","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"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","external_name":"line","restriction":""}],"args_string":"(line)","args_html":"(line)","location":{"filename":"src/ameba/inline_comments.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L68"},"def":{"name":"parse_inline_directive","args":[{"name":"line","external_name":"line","restriction":""}],"visibility":"Public","body":"if directive = COMMENT_DIRECTIVE_REGEX.match(line)\nelse\n return\nend\nif commented_out?(line.gsub(directive[0], \"\"))\n return\nend\n{action: directive[\"action\"], rules: directive[\"rules\"].split(/[\\s,]/, remove_empty: true)}\n"}}],"types":[{"html_id":"ameba/Ameba/InlineComments/Action","path":"Ameba/InlineComments/Action.html","kind":"enum","full_name":"Ameba::InlineComments::Action","name":"Action","abstract":false,"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":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L8"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Disable","name":"Disable","value":"0"},{"id":"Enable","name":"Enable","value":"1"}],"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

","instance_methods":[{"html_id":"disable?-instance-method","name":"disable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L9"},"def":{"name":"disable?","visibility":"Public","body":"self == Disable"}},{"html_id":"enable?-instance-method","name":"enable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L10"},"def":{"name":"enable?","visibility":"Public","body":"self == Enable"}}]}]},{"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/e6a5fa9/src/ameba/issue.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(code:String,rule:Ameba::Rule::Base,location:Nil|Crystal::Location,end_location:Nil|Crystal::Location,message:String,status:Status|Nil=nil,block:Source::Corrector->|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","args_html":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","location":{"filename":"src/ameba/issue.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L30"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, rule, location, end_location, message, status, block)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","doc":"The source code that triggered this issue.","summary":"

The source code that triggered this issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L10"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct(corrector)-instance-method","name":"correct","abstract":false,"args":[{"name":"corrector","external_name":"corrector","restriction":""}],"args_string":"(corrector)","args_html":"(corrector)","location":{"filename":"src/ameba/issue.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L42"},"def":{"name":"correct","args":[{"name":"corrector","external_name":"corrector","restriction":""}],"visibility":"Public","body":"@block.try(&.call(corrector))"}},{"html_id":"correctable?-instance-method","name":"correctable?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L38"},"def":{"name":"correctable?","visibility":"Public","body":"!@block.nil?"}},{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location|Nil-instance-method","name":"end_location","doc":"End location of the issue.","summary":"

End location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L19"},"def":{"name":"end_location","return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@end_location"}},{"html_id":"location:Crystal::Location|Nil-instance-method","name":"location","doc":"Location of the issue.","summary":"

Location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L16"},"def":{"name":"location","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,"location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L22"},"def":{"name":"message","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,"location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L13"},"def":{"name":"rule","return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"

Issue status.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L25"},"def":{"name":"status","return_type":"Status","visibility":"Public","body":"@status"}},{"html_id":"syntax?-instance-method","name":"syntax?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L34"},"def":{"name":"syntax?","visibility":"Public","body":"rule.is_a?(Rule::Lint::Syntax)"}}],"types":[{"html_id":"ameba/Ameba/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","abstract":false,"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/e6a5fa9/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0"},{"id":"Disabled","name":"Disabled","value":"1"}],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"instance_methods":[{"html_id":"disabled?-instance-method","name":"disabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","visibility":"Public","body":"self == Enabled"}}]}]},{"html_id":"ameba/Ameba/Presenter","path":"Ameba/Presenter.html","kind":"module","full_name":"Ameba::Presenter","name":"Presenter","abstract":false,"locations":[{"filename":"src/ameba/presenter/base_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_collection_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_presenter.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","path":"Ameba/Presenter/BasePresenter.html","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter","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/presenter/base_presenter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter"},{"html_id":"ameba/Ameba/Presenter/RulePresenter","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter"}],"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L9"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":"TODO: allow other IOs","summary":"

TODO allow other IOs

","abstract":false,"location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L7"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","path":"Ameba/Presenter/RuleCollectionPresenter.html","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_collection_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_collection_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rules)-instance-method","name":"run","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":""}],"args_string":"(rules)","args_html":"(rules)","location":{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_collection_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rules","external_name":"rules","restriction":""}],"visibility":"Public","body":"rules = rules.to_h do |rule|\n name = rule.name.split('/')\n name = \"%s/%s\" % {(name[0...-1].join('/')).colorize(:light_gray), name.last.colorize(:white)}\n {name, rule}\nend\nlongest_name = rules.max_of() do |__arg0|\n __arg0.first.size\nend\nrules.group_by() do |__arg1|\n __arg1.last.group\nend.each do |group, group_rules|\n output.puts(\"— %s\" % (group.colorize(:light_blue)).underline)\n output.puts\n group_rules.each do |name, rule|\n output.puts(\" %s [%s] %s %s\" % {rule.enabled? ? ENABLED_MARK : DISABLED_MARK, rule.severity.symbol.to_s.colorize(:green), name.ljust(longest_name), rule.description.colorize(:dark_gray)})\n end\n output.puts\nend\noutput.puts(\"Total rules: %s / %s enabled\" % {rules.size.to_s.colorize(:light_blue), rules.count() do |__arg2|\n __arg2.last.enabled?\nend.to_s.colorize(:light_blue)})\n"}}]},{"html_id":"ameba/Ameba/Presenter/RulePresenter","path":"Ameba/Presenter/RulePresenter.html","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rule)-instance-method","name":"run","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(rule)","args_html":"(rule)","location":{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rule","external_name":"rule","restriction":""}],"visibility":"Public","body":"output.puts\noutput_title(\"Rule info\")\noutput_paragraph(\"%s of a %s severity [enabled: %s]\" % {rule.name.colorize(:magenta), rule.severity.to_s.colorize(rule.severity.color), rule.enabled? ? ENABLED_MARK : DISABLED_MARK})\nif rule_description = colorize_code_fences(rule.description)\n output_paragraph(rule_description)\nend\nif rule_doc = colorize_code_fences(rule.class.parsed_doc)\n output_title(\"Detailed description\")\n output_paragraph(rule_doc)\nend\n"}}]}]},{"html_id":"ameba/Ameba/Reportable","path":"Ameba/Reportable.html","kind":"module","full_name":"Ameba::Reportable","name":"Reportable","abstract":false,"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"locations":[{"filename":"src/ameba/reportable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","instance_methods":[{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L12"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(code, rule, location, end_location, message, status, block)).tap do |issue|\n issues << issue\nend\n"}},{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L27"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L53"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L63"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L76"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"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, block)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=nil,*,prefer_name_location=false):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L37"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":5,"return_type":"Issue","visibility":"Public","body":"if prefer_name_location\n location = name_location(node)\nend\nlocation || (location = node.location)\nif prefer_name_location\n end_location = name_end_location(node)\nend\nend_location || (end_location = node.end_location)\nadd_issue(rule, location, end_location, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L71"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L58"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","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 = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L91"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,*,prefer_name_location=false,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L48"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":4,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node, message, status, block, prefer_name_location: prefer_name_location)"}},{"html_id":"issues-instance-method","name":"issues","doc":"List of reported issues.","summary":"

List of reported issues.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L9"},"def":{"name":"issues","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.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":101,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L101"},"def":{"name":"valid?","visibility":"Public","body":"issues.none?(&.enabled?)"}}]},{"html_id":"ameba/Ameba/Rule","path":"Ameba/Rule.html","kind":"module","full_name":"Ameba::Rule","name":"Rule","abstract":false,"locations":[{"filename":"src/ameba/rule/base.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECIAL","name":"SPECIAL","value":"{Lint::Syntax.rule_name, Lint::UnneededDisableDirective.rule_name}","doc":"List of names of the special rules, which\nbehave differently than usual rules.","summary":"

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

"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L174"},"def":{"name":"rules","visibility":"Public","body":"Base.inherited_rules"}}],"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/e6a5fa9/src/ameba/rule/base.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"GROUP_SEVERITY","name":"GROUP_SEVERITY","value":"{Documentation: Ameba::Severity::Warning, Lint: Ameba::Severity::Warning, Metrics: Ameba::Severity::Warning, Performance: Ameba::Severity::Warning}"}],"included_modules":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation"},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition"},{"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/DebugCalls","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls"},{"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/Formatting","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument"},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"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/SpecFilename","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename"},{"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/Typos","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos"},{"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/UnusedBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument"},{"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/Naming/AccessorMethodName","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName"},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers"},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Naming/Filename","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename"},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","kind":"class","full_name":"Ameba::Rule::Naming::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","kind":"class","full_name":"Ameba::Rule::Naming::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName"},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","kind":"class","full_name":"Ameba::Rule::Naming::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition"},{"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/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"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"}],"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":"default_severity:Ameba::Severity-class-method","name":"default_severity","abstract":false,"def":{"name":"default_severity","return_type":"Ameba::Severity","visibility":"Public","body":"if (value = @@default_severity).nil?\n @@default_severity = (GROUP_SEVERITY[group_name]? || Ameba::Severity::Convention)\nelse\n value\nend"}}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/rule/base.cr","line_number":108,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L108"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"name == other.try(&.name)"}},{"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L53"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.tap do\n test(source)\nend"}},{"html_id":"excluded?(source)-instance-method","name":"excluded?","doc":"Checks whether the source is excluded from this rule.\nIt searches for a path in `excluded` property which matches\nthe one of the given source.\n\n```\nmy_rule.excluded?(source) # => true or false\n```","summary":"

Checks whether the source is excluded from this rule.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/base.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L91"},"def":{"name":"excluded?","args":[{"name":"source","external_name":"source","restriction":""}],"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L80"},"def":{"name":"group","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.

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L112"},"def":{"name":"hash","visibility":"Public","body":"name.hash"}},{"html_id":"name-instance-method","name":"name","doc":"Returns a name of this rule, which is basically a class name.\n\n```\nclass MyRule < Ameba::Rule::Base\n def test(source)\n end\nend\n\nMyRule.new.name # => \"MyRule\"\n```","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L67"},"def":{"name":"name","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,"location":{"filename":"src/ameba/rule/base.cr","line_number":104,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L104"},"def":{"name":"special?","visibility":"Public","body":"name.in?(SPECIAL)"}},{"html_id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","name":"test","doc":"NOTE: Can't be abstract","summary":"

NOTE Can't be abstract

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","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":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","external_name":"opts","restriction":""}],"splat_index":2,"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source)"}}],"macros":[{"html_id":"issue_for(*args,**kwargs,&block)-macro","name":"issue_for","doc":"Adds an issue to the *source*","summary":"

Adds an issue to the source

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **kwargs, &block)","args_html":"(*args, **kwargs, &block)","location":{"filename":"src/ameba/rule/base.cr","line_number":117,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L117"},"def":{"name":"issue_for","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"kwargs","external_name":"kwargs","restriction":""},"splat_index":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" source.add_issue(self, \n{{ args.splat }}\n, \n{{ kwargs.double_splat }}\n) \n{{ block }}\n\n \n"}}]},{"html_id":"ameba/Ameba/Rule/Documentation","path":"Ameba/Rule/Documentation.html","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation","abstract":false,"locations":[{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L1"},{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","path":"Ameba/Rule/Documentation/Documentation.html","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation","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/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L17"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MACRO_HOOK_NAMES","name":"MACRO_HOOK_NAMES","value":"[\"inherited\", \"included\", \"extended\", \"method_missing\", \"method_added\", \"finished\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Missing documentation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L17"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_classes=(ignore_classes:Bool)-instance-method","name":"ignore_classes=","abstract":false,"args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"args_string":"(ignore_classes : Bool)","args_html":"(ignore_classes : Bool)","def":{"name":"ignore_classes=","args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"visibility":"Public","body":"@ignore_classes = ignore_classes"}},{"html_id":"ignore_classes?:Bool-instance-method","name":"ignore_classes?","abstract":false,"def":{"name":"ignore_classes?","return_type":"Bool","visibility":"Public","body":"@ignore_classes"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_enums=(ignore_enums:Bool)-instance-method","name":"ignore_enums=","abstract":false,"args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"args_string":"(ignore_enums : Bool)","args_html":"(ignore_enums : Bool)","def":{"name":"ignore_enums=","args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"visibility":"Public","body":"@ignore_enums = ignore_enums"}},{"html_id":"ignore_enums?:Bool-instance-method","name":"ignore_enums?","abstract":false,"def":{"name":"ignore_enums?","return_type":"Bool","visibility":"Public","body":"@ignore_enums"}},{"html_id":"ignore_macro_hooks=(ignore_macro_hooks:Bool)-instance-method","name":"ignore_macro_hooks=","abstract":false,"args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"args_string":"(ignore_macro_hooks : Bool)","args_html":"(ignore_macro_hooks : Bool)","def":{"name":"ignore_macro_hooks=","args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macro_hooks = ignore_macro_hooks"}},{"html_id":"ignore_macro_hooks?:Bool-instance-method","name":"ignore_macro_hooks?","abstract":false,"def":{"name":"ignore_macro_hooks?","return_type":"Bool","visibility":"Public","body":"@ignore_macro_hooks"}},{"html_id":"ignore_macros=(ignore_macros:Bool)-instance-method","name":"ignore_macros=","abstract":false,"args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"args_string":"(ignore_macros : Bool)","args_html":"(ignore_macros : Bool)","def":{"name":"ignore_macros=","args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macros = ignore_macros"}},{"html_id":"ignore_macros?:Bool-instance-method","name":"ignore_macros?","abstract":false,"def":{"name":"ignore_macros?","return_type":"Bool","visibility":"Public","body":"@ignore_macros"}},{"html_id":"ignore_modules=(ignore_modules:Bool)-instance-method","name":"ignore_modules=","abstract":false,"args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"args_string":"(ignore_modules : Bool)","args_html":"(ignore_modules : Bool)","def":{"name":"ignore_modules=","args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"visibility":"Public","body":"@ignore_modules = ignore_modules"}},{"html_id":"ignore_modules?:Bool-instance-method","name":"ignore_modules?","abstract":false,"def":{"name":"ignore_modules?","return_type":"Bool","visibility":"Public","body":"@ignore_modules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ClassDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ClassDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_classes? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::ModuleDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_modules? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::EnumDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::EnumDef, scope : AST::Scope)","args_html":"(source, node : Crystal::EnumDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_enums? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/documentation/documentation.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_defs? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Macro,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Macro, scope : AST::Scope)","args_html":"(source, node : Crystal::Macro, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if ignore_macro_hooks? && (node.name.in?(MACRO_HOOK_NAMES))\n return\nend\nignore_macros? || (check_missing_doc(source, node, scope))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","path":"Ameba/Rule/Documentation/DocumentationAdmonition.html","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition","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/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Found a %s admonition in a comment\""},{"id":"MSG_ERR","name":"MSG_ERR","value":"\"%s admonition error: %s\""},{"id":"MSG_LATE","name":"MSG_LATE","value":"\"Found a %s admonition in a comment (%s)\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"admonitions:Array(String)-instance-method","name":"admonitions","abstract":false,"def":{"name":"admonitions","visibility":"Public","body":"@admonitions"}},{"html_id":"admonitions=(admonitions:Array(String))-instance-method","name":"admonitions=","abstract":false,"args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"args_string":"(admonitions : Array(String))","args_html":"(admonitions : Array(String))","def":{"name":"admonitions=","args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"visibility":"Public","body":"@admonitions = admonitions"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type.comment?\n else\n next\n end\n if doc = token.value.to_s\n else\n next\n end\n pattern = /^#\\s*(?#{Regex.union(admonitions)})(?:\\((?.+?)\\))?(?:\\W+|$)/m\n matches = doc.scan(pattern)\n matches.each do |match|\n admonition = match[\"admonition\"]\n begin\n case expr = match[\"context\"]?.presence\n when /\\A\\d{4}-\\d{2}-\\d{2}\\Z/\n date = Time.parse(expr.not_nil!, \"%F\", location)\n issue_for_date(source, token, admonition, date)\n when /\\A\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}(:\\d{2})?\\Z/\n date = Time.parse(expr.not_nil!, \"%F #{$~[1]?.presence ? \"%T\" : \"%R\"}\", location)\n issue_for_date(source, token, admonition, date)\n else\n issue_for(token, MSG % admonition)\n end\n rescue ex\n issue_for(token, MSG_ERR % {admonition, \"#{ex}: #{expr.inspect}\"})\n end\n end\nend"}},{"html_id":"timezone:String-instance-method","name":"timezone","abstract":false,"def":{"name":"timezone","return_type":"String","visibility":"Public","body":"@timezone"}},{"html_id":"timezone=(timezone:String)-instance-method","name":"timezone=","abstract":false,"args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"args_string":"(timezone : String)","args_html":"(timezone : String)","def":{"name":"timezone=","args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"visibility":"Public","body":"@timezone = timezone"}}]}]},{"html_id":"ameba/Ameba/Rule/Layout","path":"Ameba/Rule/Layout.html","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout","abstract":false,"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/e6a5fa9/src/ameba/rule/layout/line_length.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Line too long\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/layout/line_length.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Int32-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"Int32","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Int32)-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"args_string":"(max_length : Int32)","args_html":"(max_length : Int32)","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/layout/line_length.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line.size > max_length\n issue_for({index + 1, max_length + 1}, MSG)\n end\nend"}}]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","path":"Ameba/Rule/Layout/TrailingBlankLines.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines","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_blank_lines.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/layout/trailing_blank_lines.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Excessive trailing newline detected\""},{"id":"MSG_FINAL_NEWLINE","name":"MSG_FINAL_NEWLINE","value":"\"Trailing newline missing\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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.zero? || ((source_lines.last(2)).join.presence && last_line_empty)\n return\nend\nif last_line_empty\n issue_for({source_lines_size, 1}, MSG)\nelse\n issue_for({source_lines_size, 1}, MSG_FINAL_NEWLINE) do |corrector|\n corrector.insert_before({source_lines_size + 1, 1}, '\\n')\n end\nend\n"}}]},{"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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Trailing whitespace detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if ws_index = line =~ (/\\s+$/)\n else\n next\n end\n location = {index + 1, ws_index + 1}\n end_location = {index + 1, line.size}\n issue_for(location, end_location, MSG) do |corrector|\n corrector.remove(location, end_location)\n end\nend"}}]}]},{"html_id":"ameba/Ameba/Rule/Lint","path":"Ameba/Rule/Lint.html","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint","abstract":false,"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/formatting.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L3"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L1"},{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L3"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/typos.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/ambiguous_assignment.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\": \"-=\", \"=+\": \"+=\", \"=!\": \"!=\"}"},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\""}],"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"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"

This rule checks for mistyped shorthand assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/ambiguous_assignment.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/ambiguous_assignment.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"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 suggestion = MISTAKES[op_text]?\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % suggestion)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/bad_directive.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALL_GROUP_NAMES","name":"ALL_GROUP_NAMES","value":"Rule.rules.map(&.group_name).uniq!"},{"id":"ALL_RULE_NAMES","name":"ALL_RULE_NAMES","value":"Rule.rules.map(&.rule_name)"},{"id":"AVAILABLE_ACTIONS","name":"AVAILABLE_ACTIONS","value":"InlineComments::Action.names.map(&.downcase)"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/bad_directive.cr#L20"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/bad_directive.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison to a boolean is pointless\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif node.args.size == 1\nelse\n return\nend\narg, obj = node.args.first, node.obj\ncase\nwhen arg.is_a?(Crystal::BoolLiteral)\n bool, exp = arg, obj\nwhen obj.is_a?(Crystal::BoolLiteral)\n bool, exp = obj, arg\nend\nif bool && exp\nelse\n return\nend\nif exp_code = node_source(exp, source.lines)\nelse\n return\nend\nnot = case node.name\nwhen \"==\", \"===\"\n !bool.value\nwhen \"!=\"\n bool.value\nend\nif not\n exp_code = \"!#{exp_code}\"\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/DebugCalls","path":"Ameba/Rule/Lint/DebugCalls.html","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls","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/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possibly forgotten debug-related `%s` call detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows calls to debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"method_names:Array(String)-instance-method","name":"method_names","abstract":false,"def":{"name":"method_names","visibility":"Public","body":"@method_names"}},{"html_id":"method_names=(method_names:Array(String))-instance-method","name":"method_names=","abstract":false,"args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"args_string":"(method_names : Array(String))","args_html":"(method_names : Array(String))","def":{"name":"method_names=","args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@method_names = method_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(method_names)) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG % node.name)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/debugger_statement.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possible forgotten debugger statement detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/debugger_statement.cr#L13"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/debugger_statement.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name == \"debugger\") && node.args.empty?) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require of `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/duplicated_require.cr#L16"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/duplicated_require.cr#L23"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if node.string.in?(processed_require_strings)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}]},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_ensure.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty `ensure` block detected\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_ensure.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_ensure.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node_ensure = node.ensure\nif node_ensure.nil? || (!node_ensure.nop?)\n return\nend\nissue_for(node.ensure_location, node.end_location, MSG)\n"}}]},{"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/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/e6a5fa9/src/ameba/rule/lint/empty_expression.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid empty expressions\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/empty_expression.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Expressions)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_expression.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if (node.expressions.size == 1) && node.expressions.first.nop?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty loop detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if loop?(node)\n check_node(source, node, node.block)\nend"}},{"html_id":"test(source,node:Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L53"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Formatting","path":"Ameba/Rule/Lint/Formatting.html","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting","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/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use built-in formatter to format this source\""},{"id":"MSG_ERROR","name":"MSG_ERROR","value":"\"Error while formatting: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"begin\n source_code = source.code\n result = Crystal.format(source_code, source.path)\n if result == source_code\n return\n end\n source_lines = source_code.lines\n if source_lines.empty?\n return\n end\n end_location = {source_lines.size, source_lines.last.size + 1}\n issue_for(LOCATION, MSG) do |corrector|\n corrector.replace(LOCATION, end_location, result)\n end\nrescue ex : Crystal::SyntaxException\n if fail_on_error?\n issue_for({ex.line_number, ex.column_number}, MSG_ERROR % ex.message)\n end\nrescue ex\n if fail_on_error?\n issue_for(LOCATION, MSG_ERROR % ex.message)\n end\nend"}}]},{"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/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated keys in hash literal: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::HashLiteral)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if (keys = duplicated_keys(node.entries)).empty?\n return\nend\nissue_for(node, MSG % (keys.join(\", \")))\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","path":"Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions","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_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Detected assignment with a literal value in control expression\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if (cond = node.cond).is_a?(Crystal::Assign)\nelse\n return\nend\nif literal?(cond.value)\nelse\n return\nend\nissue_for(cond, MSG)\n"}}]},{"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":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_in_condition.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in conditional\""}],"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"}],"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\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_in_condition.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_in_condition.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"visibility":"Public","body":"if static_literal?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in interpolation\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"node.expressions.select do |exp|\n (!exp.is_a?(Crystal::StringLiteral)) && (literal?(exp))\nend.each do |exp|\n issue_for(exp, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralsComparison","path":"Ameba/Rule/Lint/LiteralsComparison.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison","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/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L19"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison always evaluates to %s\""},{"id":"MSG_LIKELY","name":"MSG_LIKELY","value":"\"Comparison most likely evaluates to %s\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"===\", \"==\", \"!=\"] of ::String"}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L19"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif (obj = node.obj) && (arg = node.args.first?)\nelse\n return\nend\nobj_is_literal, obj_is_static = literal_kind?(obj)\narg_is_literal, arg_is_static = literal_kind?(arg)\nif obj_is_literal && arg_is_literal\nelse\n return\nend\nif obj.to_s == arg.to_s\nelse\n return\nend\nis_dynamic = (!obj_is_static) || (!arg_is_static)\nwhat = case node.name\nwhen \"===\"\n \"the same\"\nwhen \"==\"\n \"true\"\nwhen \"!=\"\n \"false\"\nend\nissue_for(node, (is_dynamic ? MSG_LIKELY : MSG) % what)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","path":"Ameba/Rule/Lint/MissingBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument","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/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Missing anonymous block argument. Use `&` as an argument name to indicate yielding method.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/missing_block_argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if (!scope.yields?) || node.block_arg\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L30"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","path":"Ameba/Rule/Lint/NotNil.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil","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/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid using `not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"not_nil!\"\nelse\n return\nend\nif node.obj && node.args.empty?\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","path":"Ameba/Rule/Lint/NotNilAfterNoBang.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang","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/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BLOCK_CALL_NAMES","name":"BLOCK_CALL_NAMES","value":"[\"index\", \"rindex\", \"find\"] of ::String"},{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"index\", \"rindex\", \"match\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s! {...}` instead of `%s {...}.not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usage of `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"not_nil!\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.name.in?(obj.block ? BLOCK_CALL_NAMES : CALL_NAMES)\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif name_location_end = name_end_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {obj.name, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.insert_after(name_location_end, '!')\n corrector.remove_trailing(node, {{ \".not_nil!\".size }})\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/e6a5fa9/src/ameba/rule/lint/percent_array.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Symbols `%s` may be unwanted in %s array literals\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/percent_array.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"string_array_unwanted_symbols:String-instance-method","name":"string_array_unwanted_symbols","abstract":false,"def":{"name":"string_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"args_string":"(string_array_unwanted_symbols : String)","args_html":"(string_array_unwanted_symbols : String)","def":{"name":"string_array_unwanted_symbols=","args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"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","abstract":false,"def":{"name":"symbol_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"args_string":"(symbol_array_unwanted_symbols : String)","args_html":"(symbol_array_unwanted_symbols : String)","def":{"name":"symbol_array_unwanted_symbols=","args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"visibility":"Public","body":"@symbol_array_unwanted_symbols = symbol_array_unwanted_symbols"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/percent_array.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 = start_token) && (!issue)\n issue = array_entry_invalid?(token.value.to_s, _start.raw)\n end\n when .string_array_end?\n if (_start = start_token) && (_issue = issue)\n issue_for(_start, _issue)\n end\n issue = start_token = nil\n end\nend\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/rand_zero.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"%s always returns 0\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```","summary":"

A rule that disallows rand(0) and rand(1) calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/rand_zero.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/rand_zero.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name == \"rand\") && (node.args.size == 1)) && (arg = node.args.first).is_a?(Crystal::NumberLiteral)) && (arg.value.in?(\"0\", \"1\"))\nelse\n return\nend\nissue_for(node, MSG % node)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","path":"Ameba/Rule/Lint/RedundantStringCoercion.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion","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/redundant_string_coercion.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_string_coercion.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant use of `Object#to_s` in interpolation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"(string_coercion_nodes(node)).each do |expr|\n issue_for(name_location(expr), expr.end_location, MSG)\nend"}}]},{"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":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_index.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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\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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n\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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_index.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_index.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"args, block = node.args, node.block\nif block.nil? || args.size > 1\n return\nend\nif with_index_arg?(block)\n return\nend\ncase node.name\nwhen \"with_index\"\n report(source, node, \"Remove redundant with_index\")\nwhen \"each_with_index\"\n report(source, node, \"Use each instead of each_with_index\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","path":"Ameba/Rule/Lint/RedundantWithObject.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject","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_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_object.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `each` instead of `each_with_object`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_object.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_object.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name != \"each_with_object\") || (node.args.size != 1)) || (!(block = node.block))) || (with_index_arg?(block))\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","path":"Ameba/Rule/Lint/ShadowedArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument","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_argument.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Argument `%s` is assigned before it is used\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```","summary":"

A rule that disallows shadowed arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowed exception found: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L36"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"rescues = node.rescues\nif rescues.nil?\n return\nend\n(shadowed(rescues)).each do |path|\n issue_for(path, MSG % (path.names.join(\"::\")))\nend\n"}}]},{"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_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowing outer local variable `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral|Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"find_shadowing(source, scope)"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroFor])"}}]},{"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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shared variable `%s` is used in fiber\""}],"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"}],"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 techniques 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 techniques 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","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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/SpecFilename","path":"Ameba/Rule/Lint/SpecFilename.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename","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_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L14"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Spec filename should have `_spec` suffix: %s.cr, not %s.cr\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L14"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignored_dirs:Array(String)-instance-method","name":"ignored_dirs","abstract":false,"def":{"name":"ignored_dirs","visibility":"Public","body":"@ignored_dirs"}},{"html_id":"ignored_dirs=(ignored_dirs:Array(String))-instance-method","name":"ignored_dirs=","abstract":false,"args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"args_string":"(ignored_dirs : Array(String))","args_html":"(ignored_dirs : Array(String))","def":{"name":"ignored_dirs=","args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_dirs = ignored_dirs"}},{"html_id":"ignored_filenames:Array(String)-instance-method","name":"ignored_filenames","abstract":false,"def":{"name":"ignored_filenames","visibility":"Public","body":"@ignored_filenames"}},{"html_id":"ignored_filenames=(ignored_filenames:Array(String))-instance-method","name":"ignored_filenames=","abstract":false,"args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"args_string":"(ignored_filenames : Array(String))","args_html":"(ignored_filenames : Array(String))","def":{"name":"ignored_filenames=","args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_filenames = ignored_filenames"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source:Source)-instance-method","name":"test","doc":"TODO: fix the assumption that *source.path* contains relative path","summary":"

TODO fix the assumption that source.path contains relative path

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path_ = Path[source.path].to_posix\nname = path_.stem\npath = path_.to_s\nif path.starts_with?(\"spec/\")\nelse\n return\nend\nif path.ends_with?(\".cr\")\nelse\n return\nend\nif name.ends_with?(\"_spec\")\n return\nend\nignored_dirs.each do |substr|\n if path.starts_with?(\"#{substr}/\")\n return\n end\nend\nif name.in?(ignored_filenames)\n return\nend\nexpected = \"#{name}_spec\"\nissue_for(LOCATION, MSG % {expected, name}) do\n new_path = path_.sibling(expected + path_.extension)\n FileUtils.mv(path, new_path)\nend\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\""},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L47"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":62,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L62"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nelse\n return\nend\nissue_for(arg, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":56,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L56"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L21"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L21"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","return_type":"Ameba::Severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Typos","path":"Ameba/Rule/Lint/Typos.html","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos","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/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BIN_PATH","name":"BIN_PATH","value":"Process.find_executable(\"typos\")"},{"id":"MSG","name":"MSG","value":"\"Typo found: %s -> %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L15"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"bin_path:String|Nil-instance-method","name":"bin_path","abstract":false,"location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L27"},"def":{"name":"bin_path","return_type":"String | ::Nil","visibility":"Public","body":"@bin_path || BIN_PATH"}},{"html_id":"bin_path=(bin_path:Union(String,Nil))-instance-method","name":"bin_path=","abstract":false,"args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"args_string":"(bin_path : Union(String, Nil))","args_html":"(bin_path : Union(String, Nil))","def":{"name":"bin_path=","args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"visibility":"Public","body":"@bin_path = bin_path"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"begin\n typos = typos_from(source)\n typos.try(&.each do |typo|\n corrections = typo.corrections\n message = MSG % {typo.typo, corrections.join(\" | \")}\n if corrections.size == 1\n issue_for(typo.location, typo.end_location, message) do |corrector|\n corrector.replace(typo.location, typo.end_location, corrections.first)\n end\n else\n issue_for(typo.location, typo.end_location, message)\n end\n end)\nrescue ex\n if fail_on_error?\n raise(ex)\n end\nend"}}]},{"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/e6a5fa9/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unnecessary disabling of %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L44"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unreachable code detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L44"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","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":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"visibility":"Public","body":"if unreachable_node = flow_expression.unreachable_nodes.first?\nelse\n return\nend\nissue_for(unreachable_node, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::FlowExpressionVisitor.new(self, source)"}}]},{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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.\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","name":"ignore_blocks=","abstract":false,"args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"args_string":"(ignore_blocks : Bool)","args_html":"(ignore_blocks : Bool)","def":{"name":"ignore_blocks=","args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_blocks = ignore_blocks"}},{"html_id":"ignore_blocks?:Bool-instance-method","name":"ignore_blocks?","abstract":false,"def":{"name":"ignore_blocks?","return_type":"Bool","visibility":"Public","body":"@ignore_blocks"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_procs=(ignore_procs:Bool)-instance-method","name":"ignore_procs=","abstract":false,"args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"args_string":"(ignore_procs : Bool)","args_html":"(ignore_procs : Bool)","def":{"name":"ignore_procs=","args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_procs = ignore_procs"}},{"html_id":"ignore_procs?:Bool-instance-method","name":"ignore_procs?","abstract":false,"def":{"name":"ignore_procs?","return_type":"Bool","visibility":"Public","body":"@ignore_procs"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L44"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_procs? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_blocks? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Def, scope : AST::Scope)","args_html":"(source, node : Crystal::Def, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"arguments = scope.arguments.dup\nif block_arg = node.block_arg\n arguments.reject!() do |__arg0|\n __arg0.node == block_arg\n end\nend\nignore_defs? || (find_unused_arguments(source, scope, arguments))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/UnusedBlockArgument","path":"Ameba/Rule/Lint/UnusedBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument","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_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_UNUSED","name":"MSG_UNUSED","value":"\"Unused block argument `%1$s`. If it's necessary, use `_%1$s` as an argument name to indicate that it won't be used.\""},{"id":"MSG_YIELDED","name":"MSG_YIELDED","value":"\"Use `&` as an argument name to indicate that it won't be referenced.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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_block_argument.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if node.abstract?\n return\nend\nif block_arg = node.block_arg\nelse\n return\nend\nif block_arg = scope.arguments.find() do |__arg0|\n __arg0.node == block_arg\nend\nelse\n return\nend\nif block_arg.anonymous?\n return\nend\nif scope.references?(block_arg.variable)\n return\nend\nlocation = block_arg.node.location\nend_location = location.try(&.adjust(column_number: block_arg.name.size - 1))\ncase\nwhen scope.yields?\n if location && end_location\n issue_for(location, end_location, MSG_YIELDED) do |corrector|\n corrector.remove(location, end_location)\n end\n else\n issue_for(block_arg.node, MSG_YIELDED)\n end\nwhen !block_arg.ignored?\n if location && end_location\n issue_for(location, end_location, MSG_UNUSED % block_arg.name) do |corrector|\n corrector.insert_before(location, '_')\n end\n else\n issue_for(block_arg.node, MSG_UNUSED % block_arg.name)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless assignment to variable `%s`\""}],"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"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_type_declarations=(exclude_type_declarations:Bool)-instance-method","name":"exclude_type_declarations=","abstract":false,"args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"args_string":"(exclude_type_declarations : Bool)","args_html":"(exclude_type_declarations : Bool)","def":{"name":"exclude_type_declarations=","args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"visibility":"Public","body":"@exclude_type_declarations = exclude_type_declarations"}},{"html_id":"exclude_type_declarations?:Bool-instance-method","name":"exclude_type_declarations?","abstract":false,"def":{"name":"exclude_type_declarations?","return_type":"Bool","visibility":"Public","body":"@exclude_type_declarations"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if scope.lib_def?(check_outer_scopes: true)\n return\nend\nscope.variables.each do |var|\n if (var.ignored? || var.used_in_macro?) || var.captured_by_block?\n next\n end\n if exclude_type_declarations? && (scope.assigns_type_dec?(var.name))\n next\n end\n var.assignments.each do |assign|\n check_assignment(source, assign, var)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless condition in when detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::When)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"ConditionInWhenVisitor.new(self, source, node)"}}]}]},{"html_id":"ameba/Ameba/Rule/Metrics","path":"Ameba/Rule/Metrics.html","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics","abstract":false,"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Cyclomatic complexity too high [%d/%d]\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_complexity:Int32-instance-method","name":"max_complexity","abstract":false,"def":{"name":"max_complexity","return_type":"Int32","visibility":"Public","body":"@max_complexity"}},{"html_id":"max_complexity=(max_complexity:Int32)-instance-method","name":"max_complexity=","abstract":false,"args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"args_string":"(max_complexity : Int32)","args_html":"(max_complexity : Int32)","def":{"name":"max_complexity=","args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"visibility":"Public","body":"@max_complexity = max_complexity"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"complexity = (AST::CountingVisitor.new(node)).count\nif complexity > max_complexity\nelse\n return\nend\nissue_for(node, MSG % {complexity, max_complexity}, prefer_name_location: true)\n"}}]}]},{"html_id":"ameba/Ameba/Rule/Naming","path":"Ameba/Rule/Naming.html","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming","abstract":false,"locations":[{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L1"},{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L1"},{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L1"},{"filename":"src/ameba/rule/naming/filename.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L1"},{"filename":"src/ameba/rule/naming/method_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L1"},{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L1"},{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L1"},{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L1"},{"filename":"src/ameba/rule/naming/type_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L1"},{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Naming/AccessorMethodName","path":"Ameba/Rule/Naming/AccessorMethodName.html","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName","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/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"defs = case body = node.body\nwhen Crystal::Def\n [body]\nwhen Crystal::Expressions\n body.expressions.select(Crystal::Def)\nend\ndefs.try(&.each do |def_node|\n if def_node.receiver\n else\n check_issue(source, def_node)\n end\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.receiver\n check_issue(source, node)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","path":"Ameba/Rule/Naming/AsciiIdentifiers.html","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers","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/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Identifier contains non-ascii characters\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_symbols=(ignore_symbols:Bool)-instance-method","name":"ignore_symbols=","abstract":false,"args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"args_string":"(ignore_symbols : Bool)","args_html":"(ignore_symbols : Bool)","def":{"name":"ignore_symbols=","args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"visibility":"Public","body":"@ignore_symbols = ignore_symbols"}},{"html_id":"ignore_symbols?:Bool-instance-method","name":"ignore_symbols?","abstract":false,"def":{"name":"ignore_symbols?","return_type":"Bool","visibility":"Public","body":"@ignore_symbols"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\n check_issue(source, target, target)\nend\ncheck_symbol_literal(source, node.value)\n"}},{"html_id":"test(source,node:Crystal::MultiAssign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(source, node : Crystal::MultiAssign)","args_html":"(source, node : Crystal::MultiAssign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"node.values.each do |value|\n check_symbol_literal(source, value)\nend"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L46"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.args.each do |arg|\n check_symbol_literal(source, arg)\nend\nnode.named_args.try(&.each do |arg|\n check_symbol_literal(source, arg.value)\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)\nnode.args.each do |arg|\n check_issue(source, arg, prefer_name_location: true)\n check_symbol_literal(source, arg.default_value)\nend\n"}},{"html_id":"test(source,node:Crystal::ClassVar|Crystal::InstanceVar|Crystal::Var|Crystal::Alias)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"args_string":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","args_html":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L64"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef|Crystal::EnumDef|Crystal::LibDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L68"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"visibility":"Public","body":"check_issue(source, node.name, node.name)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","path":"Ameba/Rule/Naming/BinaryOperatorParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName","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/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"When defining the `%s` operator, name its argument `other`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"excluded_operators:Array(String)-instance-method","name":"excluded_operators","abstract":false,"def":{"name":"excluded_operators","visibility":"Public","body":"@excluded_operators"}},{"html_id":"excluded_operators=(excluded_operators:Array(String))-instance-method","name":"excluded_operators=","abstract":false,"args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"args_string":"(excluded_operators : Array(String))","args_html":"(excluded_operators : Array(String))","def":{"name":"excluded_operators=","args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"visibility":"Public","body":"@excluded_operators = excluded_operators"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name\nif (name == \"->\") || (name.in?(excluded_operators))\n return\nend\nif name.chars.any?(&.alphanumeric?)\n return\nend\nif node.args.size == 1\nelse\n return\nend\nif (arg = node.args.first).name == \"other\"\n return\nend\nissue_for(arg, MSG % name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","path":"Ameba/Rule/Naming/BlockParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName","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/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed block parameter name found\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_names_ending_in_numbers=(allow_names_ending_in_numbers:Bool)-instance-method","name":"allow_names_ending_in_numbers=","abstract":false,"args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"args_string":"(allow_names_ending_in_numbers : Bool)","args_html":"(allow_names_ending_in_numbers : Bool)","def":{"name":"allow_names_ending_in_numbers=","args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"visibility":"Public","body":"@allow_names_ending_in_numbers = allow_names_ending_in_numbers"}},{"html_id":"allow_names_ending_in_numbers?:Bool-instance-method","name":"allow_names_ending_in_numbers?","abstract":false,"def":{"name":"allow_names_ending_in_numbers?","return_type":"Bool","visibility":"Public","body":"@allow_names_ending_in_numbers"}},{"html_id":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"forbidden_names:Array(String)-instance-method","name":"forbidden_names","abstract":false,"def":{"name":"forbidden_names","visibility":"Public","body":"@forbidden_names"}},{"html_id":"forbidden_names=(forbidden_names:Array(String))-instance-method","name":"forbidden_names=","abstract":false,"args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"args_string":"(forbidden_names : Array(String))","args_html":"(forbidden_names : Array(String))","def":{"name":"forbidden_names=","args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@forbidden_names = forbidden_names"}},{"html_id":"min_name_length:Int32-instance-method","name":"min_name_length","abstract":false,"def":{"name":"min_name_length","return_type":"Int32","visibility":"Public","body":"@min_name_length"}},{"html_id":"min_name_length=(min_name_length:Int32)-instance-method","name":"min_name_length=","abstract":false,"args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"args_string":"(min_name_length : Int32)","args_html":"(min_name_length : Int32)","def":{"name":"min_name_length=","args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"visibility":"Public","body":"@min_name_length = min_name_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.try(&.block).try(&.args).try(&.each do |arg|\n if valid_name?(arg.name)\n else\n issue_for(arg, MSG)\n end\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","path":"Ameba/Rule/Naming/ConstantNames.html","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames","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/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Constant name should be screaming-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\nelse\n return\nend\nname = target.to_s\nexpected = name.upcase\nif name.in?(expected, name.camelcase)\n return\nend\nissue_for(target, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/Filename","path":"Ameba/Rule/Naming/Filename.html","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename","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/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Filename should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path = Path[source.path]\nname = path.basename\nif (expected = name.underscore) == name\n return\nend\nissue_for(LOCATION, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","path":"Ameba/Rule/Naming/MethodNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Method name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","path":"Ameba/Rule/Naming/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s?' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.name =~ (/^is_([a-z]\\w*)\\??$/)\nelse\n return\nend\nalternative = $~[1]\nissue_for(node, MSG % {alternative, node.name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","path":"Ameba/Rule/Naming/QueryBoolMethods.html","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods","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/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"getter\", \"class_getter\", \"property\", \"class_property\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Consider using '%s?' for '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"calls = case body = node.body\nwhen Crystal::Call\n if body.name.in?(CALL_NAMES)\n [body]\n end\nwhen Crystal::Expressions\n (body.expressions.select(Crystal::Call)).select!() do |__arg0|\n __arg0.name.in?(CALL_NAMES)\n end\nend\ncalls.try(&.each do |exp|\n exp.args.each do |arg|\n name_node, is_bool = case arg\n when Crystal::Assign\n {arg.target, arg.value.is_a?(Crystal::BoolLiteral)}\n when Crystal::TypeDeclaration\n {arg.var, path_named?(arg.declared_type, \"Bool\")}\n else\n {nil, false}\n end\n if name_node && is_bool\n issue_for(name_node, MSG % {exp.name, name_node})\n end\n end\nend)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","path":"Ameba/Rule/Naming/RescuedExceptionsVariableName.html","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName","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/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed variable name, use one of these instead: '%s'\""},{"id":"MSG_SINGULAR","name":"MSG_SINGULAR","value":"\"Disallowed variable name, use '%s' instead\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node.rescues.try(&.each do |rescue_node|\n if valid_name?(rescue_node.name)\n next\n end\n message = allowed_names.size == 1 ? MSG_SINGULAR : MSG\n issue_for(rescue_node, message % (allowed_names.join(\"', '\")))\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","path":"Ameba/Rule/Naming/TypeNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Type name should be camelcased: %s, but it was %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Alias|Crystal::ClassDef|Crystal::ModuleDef|Crystal::LibDef|Crystal::EnumDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"args_string":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","args_html":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.camelcase) == name\n return\nend\nissue_for(node.name, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","path":"Ameba/Rule/Naming/VariableNames.html","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames","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/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Var name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Var|Crystal::InstanceVar|Crystal::ClassVar)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"args_string":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","args_html":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name})\n"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"VarVisitor.new(self, source)"}}]}]},{"html_id":"ameba/Ameba/Rule/Performance","path":"Ameba/Rule/Performance.html","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance","abstract":false,"locations":[{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L3"},{"filename":"src/ameba/rule/performance/base.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/base.cr#L3"},{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L3"},{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L3"},{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L3"},{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","path":"Ameba/Rule/Performance/AnyAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `any? {...}` instead of `%s {...}.any?`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"any?\") && (obj = node.obj)\nelse\n return\nend\nif (obj.is_a?(Crystal::Call) && obj.block) && node.block.nil?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","path":"Ameba/Rule/Performance/AnyInsteadOfEmpty.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty","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/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `!{...}.empty?` instead of `{...}.any?`\""}],"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"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"any?\"\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif node.obj\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/Base","path":"Ameba/Rule/Performance/Base.html","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base","abstract":true,"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/performance/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/base.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"A general base class for performance rules.","summary":"

A general base class for performance rules.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/performance/base.cr#L5"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/performance/base.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/base.cr#L6"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.spec? ? source : super(source)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","path":"Ameba/Rule/Performance/ChainedCallWithNoBang.html","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALLOCATING_METHOD_NAMES","name":"ALLOCATING_METHOD_NAMES","value":"[\"keys\", \"values\", \"values_at\", \"map\", \"map_with_index\", \"flat_map\", \"compact_map\", \"flatten\", \"compact\", \"select\", \"reject\", \"sample\", \"group_by\", \"chunks\", \"tally\", \"merge\", \"combinations\", \"repeated_combinations\", \"permutations\", \"repeated_permutations\", \"transpose\", \"invert\", \"chars\", \"captures\", \"named_captures\", \"clone\"] of ::String","doc":"All these methods allocate a new object","summary":"

All these methods allocate a new object

"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"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","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nif end_location = name_end_location(node)\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true) do |corrector|\n corrector.insert_after(end_location, '!')\n end\nelse\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/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/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/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","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.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"compact\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","path":"Ameba/Rule/Performance/ExcessiveAllocations.html","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L32"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `%s.each {...}` to avoid excessive allocation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L32"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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:Hash(String,String)-instance-method","name":"call_names","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Hash(String,String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"args_string":"(call_names : Hash(String, String))","args_html":"(call_names : Hash(String, String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"each\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.args.empty? && obj.block.nil?\nelse\n return\nend\nif method = call_names[obj.name]?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {method, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.replace(name_location, end_location, method)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","path":"Ameba/Rule/Performance/FirstLastAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"first\", \"last\", \"first?\", \"last?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `find {...}` instead of `%s {...}.%s`\""},{"id":"MSG_REVERSE","name":"MSG_REVERSE","value":"\"Use `reverse_each.find {...}` instead of `%s {...}.%s`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nmessage = node.name.includes?(CALL_NAMES.first) ? MSG : MSG_REVERSE\nissue_for(name_location(obj), name_end_location(node), message % {obj.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","path":"Ameba/Rule/Performance/FlattenAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `flat_map {...}` instead of `map {...}.flatten`\""}],"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"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"flatten\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","path":"Ameba/Rule/Performance/MapInsteadOfBlock.html","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"sum\", \"product\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`\""}],"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"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % {node.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","path":"Ameba/Rule/Performance/MinMaxAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"min\", \"min?\", \"max\", \"max?\", \"minmax\", \"minmax?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`.\""}],"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"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L42"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name.in?(CALL_NAMES)) && node.block.nil?) && node.args.empty?\nelse\n return\nend\nif (obj = node.obj) && obj.is_a?(Crystal::Call)\nelse\n return\nend\nif ((obj.name == \"map\") && obj.block) && obj.args.empty?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nof_name = node.name.sub(/(.+?)(\\?)?$/, \"\\\\1_of\\\\2\")\nmessage = MSG % {of_name, node.name}\nissue_for(name_location, end_location, message) do |corrector|\n if node_name_location = name_location(node)\n else\n next\n end\n corrector.replace(name_location, name_location.adjust(column_number: {{ \"map\".size - 1 }}), of_name)\n corrector.remove(node_name_location.adjust(column_number: -1), end_location)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","path":"Ameba/Rule/Performance/SizeAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `count {...}` instead of `%s {...}.size`.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":49,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"size\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]}]},{"html_id":"ameba/Ameba/Rule/Style","path":"Ameba/Rule/Style.html","kind":"module","full_name":"Ameba::Rule::Style","name":"Style","abstract":false,"locations":[{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L1"},{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L1"},{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L1"},{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L1"},{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L1"},{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L1"},{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L1"},{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L1"},{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L1"},{"filename":"src/ameba/rule/style/unless_else.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/unless_else.cr#L1"},{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L1"},{"filename":"src/ameba/rule/style/while_true.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/while_true.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Style/GuardClause","path":"Ameba/Rule/Style/GuardClause.html","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause","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/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use a guard clause (`%s`) instead of wrapping the code inside a conditional expression.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"guard_clause_source(source,guard_clause,parent)-instance-method","name":"guard_clause_source","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"args_string":"(source, guard_clause, parent)","args_html":"(source, guard_clause, parent)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L180"},"def":{"name":"guard_clause_source","args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"visibility":"Public","body":"node = parent.is_a?(Crystal::BinaryOp) ? parent : guard_clause\nnode_source(node, source.lines)\n"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L71"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"final_expression = if (body = node.body).is_a?(Crystal::Expressions)\n body.last\nelse\n body\nend\ncase final_expression\nwhen Crystal::If, Crystal::Unless\n check_ending_if(source, final_expression)\nend\n"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"args_string":"(source, node : Crystal::If | Crystal::Unless)","args_html":"(source, node : Crystal::If | Crystal::Unless)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":85,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L85"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"visibility":"Public","body":"if accepted_form?(source, node, ending: false)\n return\nend\ncase\nwhen guard_clause = guard_clause(node.then)\n parent, conditional_keyword = node.then, keyword(node)\nwhen guard_clause = guard_clause(node.else)\n parent, conditional_keyword = node.else, opposite_keyword(node)\nend\nif (guard_clause && parent) && conditional_keyword\nelse\n return\nend\nguard_clause_source = guard_clause_source(source, guard_clause, parent)\nreport_issue(source, node, guard_clause_source, conditional_keyword)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Assign])"}}]},{"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/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/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s` instead of `%s`\""},{"id":"NEW","name":"NEW","value":"\"%s(%s)\""},{"id":"OLD","name":"OLD","value":"\"%s {...}\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L41"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L58"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(filter_names)\nelse\n return\nend\nif filter_location = name_location(node)\nelse\n return\nend\nif block = node.block\nelse\n return\nend\nif (body = block.body).is_a?(Crystal::IsA)\nelse\n return\nend\nif (path = body.const).is_a?(Crystal::Path)\nelse\n return\nend\nif body.obj.is_a?(Crystal::Var)\nelse\n return\nend\nif block.args.size > 1\n return\nend\nname = path.names.join(\"::\")\nif path.global? && (!body.nil_check?)\n name = \"::#{name}\"\nend\nend_location = node.end_location\nif (!end_location) || end_location.try() do |__arg0|\n __arg0.column_number.zero?\nend\n if end_location = path.end_location\n end_location = end_location.adjust(column_number: 1)\n end\nend\nold = OLD % node.name\nnew = NEW % {node.name, name}\nmsg = MSG % {new, old}\nif end_location\n issue_for(filter_location, end_location, msg) do |corrector|\n corrector.replace(filter_location, end_location, new)\n end\nelse\n issue_for(filter_location, nil, msg)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Style/IsANil","path":"Ameba/Rule/Style/IsANil.html","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil","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/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `nil?` instead of `is_a?(Nil)`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::IsA)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(source, node : Crystal::IsA)","args_html":"(source, node : Crystal::IsA)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if node.nil_check?\n return\nend\nconst = node.const\nif path_named?(const, \"Nil\")\nelse\n return\nend\nissue_for(const, MSG) do |corrector|\n corrector.replace(node, \"#{node.obj}.nil?\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","path":"Ameba/Rule/Style/LargeNumbers.html","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers","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/large_numbers.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Large numbers should be written with underscores: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"int_min_digits:Int32-instance-method","name":"int_min_digits","abstract":false,"def":{"name":"int_min_digits","return_type":"Int32","visibility":"Public","body":"@int_min_digits"}},{"html_id":"int_min_digits=(int_min_digits:Int32)-instance-method","name":"int_min_digits=","abstract":false,"args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"args_string":"(int_min_digits : Int32)","args_html":"(int_min_digits : Int32)","def":{"name":"int_min_digits=","args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"visibility":"Public","body":"@int_min_digits = int_min_digits"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 location = token.location\n end_location = location.adjust(column_number: token.raw.size - 1)\n issue_for(location, end_location, MSG % expected) do |corrector|\n corrector.replace(location, end_location, expected)\n end\n end\nend"}}]},{"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/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid negated conditions in unless blocks\""}],"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"}],"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.empty?\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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.empty?\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","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/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if negated_condition?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","path":"Ameba/Rule/Style/ParenthesesAroundCondition.html","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition","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/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_MISSING","name":"MSG_MISSING","value":"\"Missing parentheses\""},{"id":"MSG_REDUNDANT","name":"MSG_REDUNDANT","value":"\"Redundant parentheses\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_safe_assignment=(allow_safe_assignment:Bool)-instance-method","name":"allow_safe_assignment=","abstract":false,"args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"args_string":"(allow_safe_assignment : Bool)","args_html":"(allow_safe_assignment : Bool)","def":{"name":"allow_safe_assignment=","args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"visibility":"Public","body":"@allow_safe_assignment = allow_safe_assignment"}},{"html_id":"allow_safe_assignment?:Bool-instance-method","name":"allow_safe_assignment?","abstract":false,"def":{"name":"allow_safe_assignment?","return_type":"Bool","visibility":"Public","body":"@allow_safe_assignment"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_ternary=(exclude_ternary:Bool)-instance-method","name":"exclude_ternary=","abstract":false,"args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"args_string":"(exclude_ternary : Bool)","args_html":"(exclude_ternary : Bool)","def":{"name":"exclude_ternary=","args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"visibility":"Public","body":"@exclude_ternary = exclude_ternary"}},{"html_id":"exclude_ternary?:Bool-instance-method","name":"exclude_ternary?","abstract":false,"def":{"name":"exclude_ternary?","return_type":"Bool","visibility":"Public","body":"@exclude_ternary"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"cond = node.cond\nif cond.is_a?(Crystal::Assign) && allow_safe_assignment?\n issue_for(cond, MSG_MISSING) do |corrector|\n corrector.wrap(cond, '(', ')')\n end\n return\nend\nis_ternary = node.is_a?(Crystal::If) && node.ternary?\nif is_ternary && exclude_ternary?\n return\nend\nif cond.is_a?(Crystal::Expressions)\nelse\n return\nend\nif cond.keyword.paren?\nelse\n return\nend\nif exp = cond.single_expression?\nelse\n return\nend\nif strip_parentheses?(exp, is_ternary)\nelse\n return\nend\nissue_for(cond, MSG_REDUNDANT) do |corrector|\n corrector.remove_trailing(cond, 1)\n corrector.remove_leading(cond, 1)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","path":"Ameba/Rule/Style/RedundantBegin.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin","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/style/redundant_begin.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L58"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `begin` block detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```","summary":"

A rule that disallows redundant begin blocks.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L58"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L67"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if def_loc = node.location\nelse\n return\nend\ncase body = node.body\nwhen Crystal::ExceptionHandler\n if (begin_exprs_in_handler?(body)) || (inner_handler?(body))\n return\n end\nwhen Crystal::Expressions\n if redundant_begin_in_expressions?(body)\n else\n return\n end\nelse\n return\nend\nif begin_range = def_redundant_begin_range(source, node)\nelse\n return\nend\nbegin_loc, end_loc = begin_range\nbegin_loc, end_loc = def_loc.seek(begin_loc), def_loc.seek(end_loc)\nbegin_end_loc = begin_loc.adjust(column_number: {{ \"begin\".size - 1 }})\nend_end_loc = end_loc.adjust(column_number: {{ \"end\".size - 1 }})\nissue_for(begin_loc, begin_end_loc, MSG) do |corrector|\n corrector.remove(begin_loc, begin_end_loc)\n corrector.remove(end_loc, end_end_loc)\nend\n"}}]},{"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/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/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L99"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `next` detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L99"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_next:Bool)-instance-method","name":"allow_empty_next=","abstract":false,"args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"args_string":"(allow_empty_next : Bool)","args_html":"(allow_empty_next : Bool)","def":{"name":"allow_empty_next=","args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_next = allow_empty_next"}},{"html_id":"allow_empty_next?:Bool-instance-method","name":"allow_empty_next?","abstract":false,"def":{"name":"allow_empty_next?","return_type":"Bool","visibility":"Public","body":"@allow_empty_next"}},{"html_id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","name":"allow_multi_next=","abstract":false,"args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"args_string":"(allow_multi_next : Bool)","args_html":"(allow_multi_next : Bool)","def":{"name":"allow_multi_next=","args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_next = allow_multi_next"}},{"html_id":"allow_multi_next?:Bool-instance-method","name":"allow_multi_next?","abstract":false,"def":{"name":"allow_multi_next?","return_type":"Bool","visibility":"Public","body":"@allow_multi_next"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","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":115,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L115"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Block)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":111,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L111"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/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/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `return` detected\""}],"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"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L96"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_return:Bool)-instance-method","name":"allow_empty_return=","abstract":false,"args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"args_string":"(allow_empty_return : Bool)","args_html":"(allow_empty_return : Bool)","def":{"name":"allow_empty_return=","args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_return = allow_empty_return"}},{"html_id":"allow_empty_return?:Bool-instance-method","name":"allow_empty_return?","abstract":false,"def":{"name":"allow_empty_return?","return_type":"Bool","visibility":"Public","body":"@allow_empty_return"}},{"html_id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","name":"allow_multi_return=","abstract":false,"args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"args_string":"(allow_multi_return : Bool)","args_html":"(allow_multi_return : Bool)","def":{"name":"allow_multi_return=","args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_return = allow_multi_return"}},{"html_id":"allow_multi_return?:Bool-instance-method","name":"allow_multi_return?","abstract":false,"def":{"name":"allow_multi_return?","return_type":"Bool","visibility":"Public","body":"@allow_multi_return"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","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":112,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L112"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":108,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L108"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/e6a5fa9/src/ameba/rule/style/unless_else.cr#L45"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour if over unless with else\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```","summary":"

A rule that disallows the use of an else block with the unless.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/unless_else.cr#L45"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/unless_else.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if node.else.nop?\n return\nend\nlocation = node.location\ncond_end_location = node.cond.end_location\nelse_location = node.else_location\nend_location = node.end_location\nif ((location && cond_end_location) && else_location) && end_location\nelse\n issue_for(node, MSG)\n return\nend\nissue_for(location, cond_end_location, MSG) do |corrector|\n keyword_begin_pos = source.pos(location)\n keyword_end_pos = keyword_begin_pos + ({{ \"unless\".size }})\n keyword_range = keyword_begin_pos...keyword_end_pos\n cond_end_pos = source.pos(cond_end_location, end: true)\n else_begin_pos = source.pos(else_location)\n body_range = cond_end_pos...else_begin_pos\n else_end_pos = else_begin_pos + ({{ \"else\".size }})\n end_end_pos = source.pos(end_location, end: true)\n end_begin_pos = end_end_pos - ({{ \"end\".size }})\n else_range = else_end_pos...end_begin_pos\n corrector.replace(keyword_range, \"if\")\n corrector.replace(body_range, source.code[else_range])\n corrector.replace(else_range, source.code[body_range])\nend\n"}}]},{"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/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/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\""},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%s`\""}],"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"}],"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 ExcludeCallsWithBlock: 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeCallsWithBlock: 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","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/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","abstract":false,"args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block?:Bool-instance-method","name":"exclude_calls_with_block?","abstract":false,"def":{"name":"exclude_calls_with_block?","return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","abstract":false,"args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks?:Bool-instance-method","name":"exclude_multiple_line_blocks?","abstract":false,"def":{"name":"exclude_multiple_line_blocks?","return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","abstract":false,"args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_operators?:Bool-instance-method","name":"exclude_operators?","abstract":false,"def":{"name":"exclude_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","abstract":false,"args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators?:Bool-instance-method","name":"exclude_prefix_operators?","abstract":false,"def":{"name":"exclude_prefix_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","abstract":false,"args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"html_id":"exclude_setters?:Bool-instance-method","name":"exclude_setters?","abstract":false,"def":{"name":"exclude_setters?","return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Union(Int32,Nil)-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Union(Int32,Nil))-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_length : Union(Int32, Nil))","args_html":"(max_length : Union(Int32, Nil))","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Union(Int32,Nil)-instance-method","name":"max_line_length","abstract":false,"def":{"name":"max_line_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Union(Int32,Nil))-instance-method","name":"max_line_length=","abstract":false,"args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_line_length : Union(Int32, Nil))","args_html":"(max_line_length : Union(Int32, Nil))","def":{"name":"max_line_length=","args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_line_length = max_line_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L215"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\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, block, body)\n"}}]},{"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/e6a5fa9/src/ameba/rule/style/while_true.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"While statement using true literal as condition\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/while_true.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::While)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/while_true.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if node.cond.true_literal?\nelse\n return\nend\nif location = node.location\nelse\n return\nend\nif end_location = node.cond.end_location\nelse\n return\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(location, end_location, \"loop do\")\nend\n"}}]}]}]},{"html_id":"ameba/Ameba/Runner","path":"Ameba/Runner.html","kind":"class","full_name":"Ameba::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/runner.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L12"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a runner for inspecting sources files.\nHolds a list of rules to do inspection based on,\nlist of sources to run inspection on and a formatter\nto prepare a report.\n\n```\nconfig = Ameba::Config.load\nrunner = Ameba::Runner.new config\nrunner.run.success? # => true or false\n```","summary":"

Represents a runner for inspecting sources files.

","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.

","abstract":false,"args":[{"name":"config","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","args_html":"(config : Config)","location":{"filename":"src/ameba/runner.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L61"},"def":{"name":"new","args":[{"name":"config","external_name":"config","restriction":"Config"}],"visibility":"Public","body":"_ = allocate\n_.initialize(config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"explain(location,output=STDOUT)-instance-method","name":"explain","doc":"Explains an issue at a specified *location*.\n\nRunner should perform inspection before doing the explain.\nThis is necessary to be able to find the issue at a specified location.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.explain({file: file, line: l, column: c})\n```","summary":"

Explains an issue at a specified location.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","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":160,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L160"},"def":{"name":"explain","args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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,"location":{"filename":"src/ameba/runner.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L87"},"def":{"name":"run","visibility":"Public","body":"begin\n @formatter.started(@sources)\n channels = @sources.map do\n Channel(Exception | ::Nil).new\n end\n (@sources.zip(channels)).each do |source, channel|\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,"location":{"filename":"src/ameba/runner.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L35"},"def":{"name":"sources","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,"location":{"filename":"src/ameba/runner.cr","line_number":172,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L172"},"def":{"name":"success?","visibility":"Public","body":"@sources.all? do |source|\n source.issues.reject(&.disabled?).none?() do |__arg7|\n __arg7.rule.severity <= @severity\n end\nend"}}],"types":[{"html_id":"ameba/Ameba/Runner/InfiniteCorrectionLoopError","path":"Ameba/Runner/InfiniteCorrectionLoopError.html","kind":"class","full_name":"Ameba::Runner::InfiniteCorrectionLoopError","name":"InfiniteCorrectionLoopError","abstract":false,"superclass":{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"ameba/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"ameba/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"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/runner.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Runner","kind":"class","full_name":"Ameba::Runner","name":"Runner"},"doc":"An error indicating that the inspection loop got stuck correcting\nissues back and forth.","summary":"

An error indicating that the inspection loop got stuck correcting issues back and forth.

","constructors":[{"html_id":"new(path,issues_by_iteration,loop_start=-1)-class-method","name":"new","abstract":false,"args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"args_string":"(path, issues_by_iteration, loop_start = -1)","args_html":"(path, issues_by_iteration, loop_start = -1)","location":{"filename":"src/ameba/runner.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L16"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(path, issues_by_iteration, loop_start)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]}]},{"html_id":"ameba/Ameba/Severity","path":"Ameba/Severity.html","kind":"enum","full_name":"Ameba::Severity","name":"Severity","abstract":false,"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":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Error","name":"Error","value":"0"},{"id":"Warning","name":"Warning","value":"1"},{"id":"Convention","name":"Convention","value":"2"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/severity.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L41"},"def":{"name":"parse","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"begin\n super(name)\nrescue ArgumentError\n raise(\"Incorrect severity name #{name}. Try one of: #{values.map(&.to_s).join(\", \")}\")\nend"}}],"instance_methods":[{"html_id":"color:Colorize::Color-instance-method","name":"color","doc":"Returns a color uniquely indicating severity.\n\n```\nSeverity::Warning.color # => Colorize::ColorANSI::Red\n```","summary":"

Returns a color uniquely indicating severity.

","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L27"},"def":{"name":"color","return_type":"Colorize::Color","visibility":"Public","body":"case self\nin Error\n Colorize::ColorANSI::Red\nin Warning\n Colorize::ColorANSI::Red\nin Convention\n Colorize::ColorANSI::Blue\nend"}},{"html_id":"convention?-instance-method","name":"convention?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L7"},"def":{"name":"convention?","visibility":"Public","body":"self == Convention"}},{"html_id":"error?-instance-method","name":"error?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L5"},"def":{"name":"error?","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,"location":{"filename":"src/ameba/severity.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L14"},"def":{"name":"symbol","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?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L6"},"def":{"name":"warning?","visibility":"Public","body":"self == Warning"}}]},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L49"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Converter for `YAML.mapping` which converts severity enum to and from YAML.","summary":"

Converter for YAML.mapping which converts severity enum to and from YAML.

","class_methods":[{"html_id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"from_yaml","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":{"filename":"src/ameba/severity.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L50"},"def":{"name":"from_yaml","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"if node.is_a?(YAML::Nodes::Scalar)\nelse\n raise(\"Severity must be a scalar, not #{node.class}\")\nend\ncase value = node.value\nwhen String\n Severity.parse(value)\nwhen Nil\n raise(\"Missing severity\")\nelse\n raise(\"Incorrect severity: #{value}\")\nend\n"}},{"html_id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","name":"to_yaml","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"args_string":"(value : Severity, yaml : YAML::Nodes::Builder)","args_html":"(value : Severity, yaml : YAML::Nodes::Builder)","location":{"filename":"src/ameba/severity.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L63"},"def":{"name":"to_yaml","args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"visibility":"Public","body":"yaml.scalar(value)"}}]},{"html_id":"ameba/Ameba/Source","path":"Ameba/Source.html","kind":"class","full_name":"Ameba::Source","name":"Source","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/source.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L4"},{"filename":"src/ameba/source/corrector.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L3"},{"filename":"src/ameba/source/rewriter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/support.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"An entity that represents a Crystal source file.\nHas path, lines of code and issues reported by rules.","summary":"

An entity that represents a Crystal source file.

","constructors":[{"html_id":"new(code:String,path:String=\"\",normalize=true)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"args_string":"(code : String, path : String = \"\", normalize = true)","args_html":"(code : String, path : String = "", normalize = true)","location":{"filename":"src/ameba/spec/support.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/support.cr#L11"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path, normalize)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(code:String,path:String=\"\")-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.

","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"args_string":"(code : String, path : String = \"\")","args_html":"(code : String, path : String = "")","location":{"filename":"src/ameba/source.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L22"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"ast:Crystal::ASTNode-instance-method","name":"ast","doc":"Returns AST nodes constructed by `Crystal::Parser`.\n\n```\nsource = Ameba::Source.new code, path\nsource.ast\n```","summary":"

Returns AST nodes constructed by Crystal::Parser.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L59"},"def":{"name":"ast","return_type":"Crystal::ASTNode","visibility":"Public","body":"if (value = @ast).nil?\n @ast = ((Crystal::Parser.new(code)).tap(&.wants_doc = true).tap(&.filename = path).parse)\nelse\n value\nend"}},{"html_id":"code:String-instance-method","name":"code","doc":"Crystal code (content of a source file).","summary":"

Crystal code (content of a source file).

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L12"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct?-instance-method","name":"correct?","doc":"Corrects any correctable issues and updates `code`.\nReturns `false` if no issues were corrected.","summary":"

Corrects any correctable issues and updates #code.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L27"},"def":{"name":"correct?","visibility":"Public","body":"corrector = Corrector.new(code)\nissues.each(&.correct(corrector))\ncorrected_code = corrector.process\nif code == corrected_code\n return false\nend\n@code = corrected_code\n@lines = nil\n@ast = nil\ntrue\n"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L66"},"def":{"name":"fullpath","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 split 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```","summary":"

Returns lines of code split by new line character.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L51"},"def":{"name":"lines","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` otherwise.","summary":"

Returns true if filepath matches the source's path, false otherwise.

","abstract":false,"args":[{"name":"filepath","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/ameba/source.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L76"},"def":{"name":"matches_path?","args":[{"name":"filepath","external_name":"filepath","restriction":""}],"visibility":"Public","body":"fullpath == (File.expand_path(filepath))"}},{"html_id":"path:String-instance-method","name":"path","doc":"Path to the source file.","summary":"

Path to the source file.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L9"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"pos(location:Crystal::Location,endend_pos=false):Int32-instance-method","name":"pos","doc":"Converts an AST location to a string position.","summary":"

Converts an AST location to a string position.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"args_string":"(location : Crystal::Location, end end_pos = false) : Int32","args_html":"(location : Crystal::Location, end end_pos = false) : Int32","location":{"filename":"src/ameba/source.cr","line_number":81,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L81"},"def":{"name":"pos","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"return_type":"Int32","visibility":"Public","body":"line, column = location.line_number, location.column_number\npos = ((lines[0...(line - 1)].sum(&.size) + line) + column) - 2\nif end_pos\n pos = pos + 1\nend\npos\n"}},{"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.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L71"},"def":{"name":"spec?","visibility":"Public","body":"path.ends_with?(\"_spec.cr\")"}}],"types":[{"html_id":"ameba/Ameba/Source/Corrector","path":"Ameba/Source/Corrector.html","kind":"class","full_name":"Ameba::Source::Corrector","name":"Corrector","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/source/corrector.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class takes source code and rewrites it based\non the different correction actions supplied.","summary":"

This class takes source code and rewrites it based on the different correction actions supplied.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/corrector.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L9"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"insert_after(location,end_location,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(location, end_location, nil, content)`","summary":"

Shortcut for #wrap(location, end_location, nil, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L65"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_after(range:Range(Int32,Int32),content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(range, nil, content)`","summary":"

Shortcut for #wrap(range, nil, content)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L70"},"def":{"name":"insert_after","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_after(begin_pos, end_pos, content)\n"}},{"html_id":"insert_after(pos:Int32,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(...pos, content)`","summary":"

Shortcut for #insert_after(...pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L92"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(pos, content)"}},{"html_id":"insert_after(node:Crystal::ASTNode,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(node, nil, content)`","summary":"

Shortcut for #wrap(node, nil, content)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":164,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L164"},"def":{"name":"insert_after","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(end_location(node), content)"}},{"html_id":"insert_after(location,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(location, location, content)`","summary":"

Shortcut for #insert_after(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L87"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after((loc_to_pos(location)) + 1, content)"}},{"html_id":"insert_before(location,end_location,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(location, end_location, content, nil)`","summary":"

Shortcut for #wrap(location, end_location, content, nil)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L53"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_before(range:Range(Int32,Int32),content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(range, content, nil)`","summary":"

Shortcut for #wrap(range, content, nil)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L58"},"def":{"name":"insert_before","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_before(begin_pos, end_pos, content)\n"}},{"html_id":"insert_before(pos:Int32,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos.., content)`","summary":"

Shortcut for #insert_before(pos.., content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":82,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L82"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(pos, content)"}},{"html_id":"insert_before(node:Crystal::ASTNode,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(node, content, nil)`","summary":"

Shortcut for #wrap(node, content, nil)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":159,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L159"},"def":{"name":"insert_before","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(location(node), content)"}},{"html_id":"insert_before(location,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(location, location, content)`","summary":"

Shortcut for #insert_before(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L77"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/corrector.cr","line_number":196,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L196"},"def":{"name":"process","visibility":"Public","body":"@rewriter.process"}},{"html_id":"remove(location,end_location)-instance-method","name":"remove","doc":"Shortcut for `replace(location, end_location, \"\")`","summary":"

Shortcut for #replace(location, end_location, "")

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"args_string":"(location, end_location)","args_html":"(location, end_location)","location":{"filename":"src/ameba/source/corrector.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L41"},"def":{"name":"remove","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove(range:Range(Int32,Int32))-instance-method","name":"remove","doc":"Shortcut for `replace(range, \"\")`","summary":"

Shortcut for #replace(range, "")

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"args_string":"(range : Range(Int32, Int32))","args_html":"(range : Range(Int32, Int32))","location":{"filename":"src/ameba/source/corrector.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L46"},"def":{"name":"remove","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(begin_pos, end_pos)\n"}},{"html_id":"remove(node:Crystal::ASTNode)-instance-method","name":"remove","doc":"Shortcut for `replace(node, \"\")`","summary":"

Shortcut for #replace(node, "")

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/source/corrector.cr","line_number":154,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L154"},"def":{"name":"remove","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"remove(location(node), end_location(node))"}},{"html_id":"remove_leading(location,end_location,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L110"},"def":{"name":"remove_leading","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(location)) + size)"}},{"html_id":"remove_leading(range:Range(Int32,Int32),size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L115"},"def":{"name":"remove_leading","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos, begin_pos + size)\n"}},{"html_id":"remove_leading(node:Crystal::ASTNode,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the end of the node.","summary":"

Removes size characters from the beginning of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":176,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L176"},"def":{"name":"remove_leading","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_leading(location(node), end_location(node), size)"}},{"html_id":"remove_preceding(location,end_location,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L97"},"def":{"name":"remove_preceding","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove((loc_to_pos(location)) - size, loc_to_pos(location))"}},{"html_id":"remove_preceding(range:Range(Int32,Int32),size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L102"},"def":{"name":"remove_preceding","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos - size, begin_pos)\n"}},{"html_id":"remove_preceding(node:Crystal::ASTNode,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the given node.","summary":"

Removes size characters prior to the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":169,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L169"},"def":{"name":"remove_preceding","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_preceding(location(node), end_location(node), size)"}},{"html_id":"remove_trailing(location,end_location,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":123,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L123"},"def":{"name":"remove_trailing","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(((loc_to_pos(end_location)) + 1) - size, (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove_trailing(range:Range(Int32,Int32),size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":128,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L128"},"def":{"name":"remove_trailing","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"end_pos = range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(end_pos - size, end_pos)\n"}},{"html_id":"remove_trailing(node:Crystal::ASTNode,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the beginning of the node.","summary":"

Removes size characters from the end of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L183"},"def":{"name":"remove_trailing","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_trailing(location(node), end_location(node), size)"}},{"html_id":"replace(location,end_location,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L17"},"def":{"name":"replace","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.replace(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"replace(range:Range(Int32,Int32),content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L22"},"def":{"name":"replace","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.replace(begin_pos, end_pos, content)\n"}},{"html_id":"replace(node:Crystal::ASTNode,content)-instance-method","name":"replace","doc":"Replaces the code of the given node with *content*.","summary":"

Replaces the code of the given node with content.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":144,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L144"},"def":{"name":"replace","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"replace(location(node), end_location(node), content)"}},{"html_id":"wrap(location,end_location,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(location, end_location, insert_before, insert_after)","args_html":"(location, end_location, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L29"},"def":{"name":"wrap","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"@rewriter.wrap(loc_to_pos(location), (loc_to_pos(end_location)) + 1, insert_before, insert_after)"}},{"html_id":"wrap(range:Range(Int32,Int32),insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(range : Range(Int32, Int32), insert_before, insert_after)","args_html":"(range : Range(Int32, Int32), insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L34"},"def":{"name":"wrap","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.wrap(begin_pos, end_pos, insert_before, insert_after)\n"}},{"html_id":"wrap(node:Crystal::ASTNode,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given node.","summary":"

Inserts the given strings before and after the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(node : Crystal::ASTNode, insert_before, insert_after)","args_html":"(node : Crystal::ASTNode, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":149,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L149"},"def":{"name":"wrap","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"wrap(location(node), end_location(node), insert_before, insert_after)"}}]},{"html_id":"ameba/Ameba/Source/Rewriter","path":"Ameba/Source/Rewriter.html","kind":"class","full_name":"Ameba::Source::Rewriter","name":"Rewriter","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/source/rewriter.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L61"},{"filename":"src/ameba/source/rewriter/action.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter/action.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class performs the heavy lifting in the source rewriting process.\nIt schedules code updates to be performed in the correct order.\n\nFor simple cases, the resulting source will be obvious.\n\nExamples for more complex cases follow. Assume these examples are acting on\nthe source `puts(:hello, :world)`. The methods `#wrap`, `#remove`, etc.\nreceive a range as the first two arguments; for clarity, examples below use\nEnglish sentences and a string of raw code instead.\n\n## Overlapping deletions:\n\n* remove `:hello, `\n* remove `, :world`\n\nThe overlapping ranges are merged and `:hello, :world` will be removed.\n\n## Multiple actions at the same end points:\n\nResults will always be independent of the order they were given.\nException: rewriting actions done on exactly the same range (covered next).\n\nExample:\n\n* replace `, ` by ` => `\n* wrap `:hello, :world` with `{` and `}`\n* replace `:world` with `:everybody`\n* wrap `:world` with `[`, `]`\n\nThe resulting string will be `puts({:hello => [:everybody]})`\nand this result is independent of the order the instructions were given in.\n\n## Multiple wraps on same range:\n\n* wrap `:hello` with `(` and `)`\n* wrap `:hello` with `[` and `]`\n\nThe wraps are combined in order given and results would be `puts([(:hello)], :world)`.\n\n## Multiple replacements on same range:\n\n* replace `:hello` by `:hi`, then\n* replace `:hello` by `:hey`\n\nThe replacements are made in the order given, so the latter replacement\nsupersedes the former and `:hello` will be replaced by `:hey`.\n\n## Swallowed insertions:\n\n* wrap `world` by `__`, `__`\n* replace `:hello, :world` with `:hi`\n\nA containing replacement will swallow the contained rewriting actions\nand `:hello, :world` will be replaced by `:hi`.\n\n## Implementation\n\nThe updates are organized in a tree, according to the ranges they act on\n(where children are strictly contained by their parent).","summary":"

This class performs the heavy lifting in the source rewriting process.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L64"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L62"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"empty?-instance-method","name":"empty?","doc":"Returns `true` if no (non trivial) update has been recorded","summary":"

Returns true if no (non trivial) update has been recorded

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L69"},"def":{"name":"empty?","visibility":"Public","body":"@action_root.empty?"}},{"html_id":"insert_after(begin_pos,end_pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(begin_pos, end_pos, nil, content)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, nil, content)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L97"},"def":{"name":"insert_after","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, nil, content)"}},{"html_id":"insert_after(pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(pos, pos, content)`","summary":"

Shortcut for #insert_after(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":107,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L107"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(pos, pos, content)"}},{"html_id":"insert_before(begin_pos,end_pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(begin_pos, end_pos, content, nil)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, content, nil)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L92"},"def":{"name":"insert_before","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, content, nil)"}},{"html_id":"insert_before(pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos, pos, content)`","summary":"

Shortcut for #insert_before(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L102"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(pos, pos, content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L112"},"def":{"name":"process","visibility":"Public","body":"String.build do |io|\n last_end = 0\n @action_root.ordered_replacements.each do |begin_pos, end_pos, replacement|\n (io << code[last_end...begin_pos]) << replacement\n last_end = end_pos\n end\n io << code[last_end...code.size]\nend"}},{"html_id":"remove(begin_pos,end_pos)-instance-method","name":"remove","doc":"Shortcut for `replace(begin_pos, end_pos, \"\")`","summary":"

Shortcut for #replace(begin_pos, end_pos, "")

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"args_string":"(begin_pos, end_pos)","args_html":"(begin_pos, end_pos)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L87"},"def":{"name":"remove","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"visibility":"Public","body":"replace(begin_pos, end_pos, \"\")"}},{"html_id":"replace(begin_pos,end_pos,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L74"},"def":{"name":"replace","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, replacement: content.to_s)"}},{"html_id":"wrap(begin_pos,end_pos,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(begin_pos, end_pos, insert_before, insert_after)","args_html":"(begin_pos, end_pos, insert_before, insert_after)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L80"},"def":{"name":"wrap","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, insert_before: insert_before.to_s, insert_after: insert_after.to_s)"}}]}]},{"html_id":"ameba/Ameba/Spec","path":"Ameba/Spec.html","kind":"module","full_name":"Ameba::Spec","name":"Spec","abstract":false,"locations":[{"filename":"src/ameba/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L2"},{"filename":"src/ameba/spec/be_valid.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Spec/AnnotatedSource","path":"Ameba/Spec/AnnotatedSource.html","kind":"class","full_name":"Ameba::Spec::AnnotatedSource","name":"AnnotatedSource","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/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ABBREV","name":"ABBREV","value":"\"[...]\""},{"id":"ANNOTATION_PATTERN_1","name":"ANNOTATION_PATTERN_1","value":"/\\A\\s*(# )?(\\^+|\\^{})( error:)? /"},{"id":"ANNOTATION_PATTERN_2","name":"ANNOTATION_PATTERN_2","value":"\" # error: \""}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Parsed representation of code annotated with the `# ^^^ error: Message` style","summary":"

Parsed representation of code annotated with the # ^^^ error: Message style

","class_methods":[{"html_id":"parse(annotated_code)-class-method","name":"parse","doc":"Separates annotation lines from code lines. Tracks the real\ncode line number that each annotation corresponds to.","summary":"

Separates annotation lines from code lines.

","abstract":false,"args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"args_string":"(annotated_code)","args_html":"(annotated_code)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L16"},"def":{"name":"parse","args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"visibility":"Public","body":"lines = [] of String\nannotations = [] of ::Tuple(Int32, String, String)\ncode_lines = annotated_code.split('\\n')\ncode_lines.each do |code_line|\n case\n when 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 when 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\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:Array(String),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.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"args_string":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","args_html":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L43"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lines, annotations)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(lines:Array(String),issues:Enumerable(Issue))-class-method","name":"new","doc":"Annotates the source code with the Ameba issues provided.\n\nNOTE: Annotations are sorted so that reconstructing the annotation\n text via `#to_s` is deterministic.","summary":"

Annotates the source code with the Ameba issues provided.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"args_string":"(lines : Array(String), issues : Enumerable(Issue))","args_html":"(lines : Array(String), issues : Enumerable(Issue))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L53"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L59"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"(other.is_a?(AnnotatedSource) && (other.lines == lines)) && (match_annotations?(other))"}},{"html_id":"annotations:Array(Tuple(Int32,String,String))-instance-method","name":"annotations","doc":"Each entry is the line number, annotation prefix, and message.\nThe prefix is empty if the annotation is at the end of a code line.","summary":"

Each entry is the line number, annotation prefix, and message.

","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L12"},"def":{"name":"annotations","return_type":"Array(::Tuple(Int32, String, String))","visibility":"Public","body":"@annotations"}},{"html_id":"lines:Array(String)-instance-method","name":"lines","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L8"},"def":{"name":"lines","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","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L110"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"reconstructed = lines.dup\nannotations.reverse_each do |line_number, prefix, message|\n if prefix.empty?\n __temp_62 = line_number - 1\n reconstructed[__temp_62] = reconstructed[__temp_62] + \"#{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"}}]},{"html_id":"ameba/Ameba/Spec/BeValid","path":"Ameba/Spec/BeValid.html","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid","abstract":false,"locations":[{"filename":"src/ameba/spec/be_valid.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"instance_methods":[{"html_id":"be_valid-instance-method","name":"be_valid","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L3"},"def":{"name":"be_valid","visibility":"Public","body":"BeValidExpectation.new"}}]},{"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/e6a5fa9/src/ameba/spec/be_valid.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"new","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","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/spec/be_valid.cr#L13"},"def":{"name":"failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"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 |issue|\n str << \" * #{issue.rule.name}: #{issue.message}\\n\"\n end\nend"}},{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"initialize","visibility":"Public","body":""}},{"html_id":"match(source)-instance-method","name":"match","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/spec/be_valid.cr#L9"},"def":{"name":"match","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.valid?"}},{"html_id":"negative_failure_message(source)-instance-method","name":"negative_failure_message","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/spec/be_valid.cr#L22"},"def":{"name":"negative_failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"\"Source expected to be invalid, but it is valid.\""}}]},{"html_id":"ameba/Ameba/Spec/ExpectIssue","path":"Ameba/Spec/ExpectIssue.html","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue","abstract":false,"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":96,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Mixin for `expect_issue` and `expect_no_issues`\n\nThis 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, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\nEquivalent assertion without `expect_issue`:\n\n source = Source.new <<-CRYSTAL, \"source.cr\"\n a do\n b\n end.c\n CRYSTAL\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:3:1\"\n issue.end_location.to_s.should eq \"source.cr:3:5\"\n issue.message.should eq(\n \"Avoid chaining a method call on a do...end block.\"\n )\n\nAutocorrection can be tested using `expect_correction` after\n`expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n x % 2 == 0\n # ^^^^^^^^ error: Replace with `Int#even?`.\n CRYSTAL\n\n expect_correction source, <<-CRYSTAL\n x.even?\n CRYSTAL\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.\n\nIf the code produces an issue that could not be auto-corrected, you can\nuse `expect_no_corrections` after `expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\n expect_no_corrections source\n\nIf your code has variables of different lengths, you can use `%{foo}`,\n`^{foo}`, and `_{foo}` to format your template; you can also abbreviate\nissue messages with `[...]`:\n\n %w[raise fail].each do |keyword|\n expect_issue subject, <<-CRYSTAL, keyword: keyword\n %{keyword} Exception.new(msg)\n # ^{keyword}^^^^^^^^^^^^^^^^^ error: Redundant `Exception.new` [...]\n CRYSTAL\n\n %w[has_one has_many].each do |type|\n expect_issue subject, <<-CRYSTAL, type: type\n class Book\n %{type} :chapter, foreign_key: \"book_id\"\n _{type} # ^^^^^^^^^^^^^^^^^^^^^^ error: Specifying the default [...]\n end\n CRYSTAL\n end\n\nIf you need to specify an issue on a blank line, use the empty `^{}` marker:\n\n expect_issue subject, <<-CRYSTAL\n\n # ^{} error: Missing frozen string literal comment.\n puts 1\n CRYSTAL","summary":"

Mixin for #expect_issue and #expect_no_issues

","instance_methods":[{"html_id":"expect_correction(source,correction,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_correction","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, correction, *, file = __FILE__, line = __LINE__)","args_html":"(source, correction, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":131,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L131"},"def":{"name":"expect_correction","args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":2,"visibility":"Public","body":"if source.correct?\nelse\n raise(\"Use `expect_no_corrections` if the code will not change\")\nend\nif correction == source.code\n return\nend\nfail(\"Expected correction:\\n\\n#{correction}\\n\\nGot:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_issue(rules:Rule::Base|Enumerable(Rule::Base),annotated_code:String,path=\"\",*,file=__FILE__,line=__LINE__,**replacements)-instance-method","name":"expect_issue","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = \"\", *, file = __FILE__, line = __LINE__, **replacements)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = "", *, file = __FILE__, line = __LINE__, **replacements)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L99"},"def":{"name":"expect_issue","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":{"name":"replacements","external_name":"replacements","restriction":""},"splat_index":3,"visibility":"Public","body":"annotated_code = format_issue(annotated_code, **replacements)\nexpected_annotations = AnnotatedSource.parse(annotated_code)\nlines = expected_annotations.lines\ncode = lines.join('\\n')\nif code == annotated_code\n raise(\"Use `expect_no_issues` to assert that no issues are found\")\nend\nsource, actual_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\nsource\n"}},{"html_id":"expect_no_corrections(source,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_corrections","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, *, file = __FILE__, line = __LINE__)","args_html":"(source, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L146"},"def":{"name":"expect_no_corrections","args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":1,"visibility":"Public","body":"if source.correct?\nelse\n return\nend\nfail(\"Expected no corrections, but got:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_no_issues(rules:Rule::Base|Enumerable(Rule::Base),code:String,path=\"\",*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_issues","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = \"\", *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = "", *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L156"},"def":{"name":"expect_no_issues","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":3,"visibility":"Public","body":"lines = code.split('\\n')\n_, actual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations.to_s == code\n return\nend\nfail(\"Expected no issues, but got:\\n\\n#{actual_annotations}\", file, line)\n"}}]},{"html_id":"ameba/Ameba/Spec/Util","path":"Ameba/Spec/Util.html","kind":"module","full_name":"Ameba::Spec::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/spec/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"},"instance_methods":[{"html_id":"normalize_code(code,separator='\\n')-instance-method","name":"normalize_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","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/e6a5fa9/src/ameba/spec/util.cr#L2"},"def":{"name":"normalize_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","default_value":"'\\n'","external_name":"separator","restriction":""}],"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"}}]}]},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

Represents Crystal syntax tokenizer based on Crystal::Lexer.

","constructors":[{"html_id":"new(lexer:Crystal::Lexer)-class-method","name":"new","doc":"Instantiates Tokenizer using a `lexer`.\n\n```\nlexer = Crystal::Lexer.new(code)\nAmeba::Tokenizer.new(lexer)\n```","summary":"

Instantiates Tokenizer using a lexer.

","abstract":false,"args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"args_string":"(lexer : Crystal::Lexer)","args_html":"(lexer : Crystal::Lexer)","location":{"filename":"src/ameba/tokenizer.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L34"},"def":{"name":"new","args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lexer)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(source)-class-method","name":"new","doc":"Instantiates Tokenizer using a `source`.\n\n```\nsource = Ameba::Source.new code, path\nAmeba::Tokenizer.new(source)\n```","summary":"

Instantiates Tokenizer using a source.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/tokenizer.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L20"},"def":{"name":"new","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"run(&block:Crystal::Token->_)-instance-method","name":"run","doc":"Runs the tokenizer and yields each token as a block argument.\n\n```\nAmeba::Tokenizer.new(source).run do |token|\n puts token\nend\n```","summary":"

Runs the tokenizer and yields each token as a block argument.

","abstract":false,"location":{"filename":"src/ameba/tokenizer.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L44"},"def":{"name":"run","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crystal::Token -> _)"},"visibility":"Public","body":"begin\n run_normal_state(@lexer, &block)\n true\nrescue e : Crystal::SyntaxException\n false\nend"}}]}]}]}} \ No newline at end of file +{"repository_name":"ameba","body":"

\n \n

Ameba

\n

Code style linter for Crystal

\n

\n \n (a single-celled animal that catches food and moves about by extending fingerlike projections of protoplasm)\n \n

\n

\n \n \n \n

\n

\n\n- [About](#about)\n- [Usage](#usage)\n - [Watch a tutorial](#watch-a-tutorial)\n - [Autocorrection](#autocorrection)\n - [Explain issues](#explain-issues)\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 - [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.....................FF....................................................................\n\nsrc/ameba/formatter/flycheck_formatter.cr:6:37\n[W] Lint/UnusedArgument: Unused argument `location`. If it's necessary, use `_` as an argument name to indicate that it won't be used.\n> source.issues.each do |issue, location|\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:14\n[W] Lint/UselessAssign: Useless assignment to variable `s`\n> return s += issues.size\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:7 [Correctable]\n[C] Style/RedundantReturn: Redundant `return` detected\n> return s += issues.size\n ^---------------------^\n\nFinished in 389.45 milliseconds\n107 inspected, 3 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### Autocorrection\n\nRules that are marked as `[Correctable]` in the output can be automatically corrected using `--fix` flag:\n\n```sh\n$ ameba --fix\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### Run in parallel\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```\n\nBuild `bin/ameba` binary within your project directory while running `shards install`.\n\n### OS X\n\n```sh\n$ brew tap crystal-ameba/ameba\n$ brew install ameba\n```\n\n### Docker\n\nBuild the image:\n\n```sh\n$ docker build -t ghcr.io/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 ghcr.io/crystal-ameba/ameba\n```\n\nAlso available on GitHub: https://github.com/crystal-ameba/ameba/pkgs/container/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### 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\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- [Sija](https://github.com/Sija) Sijawusz Pur Rahnama - contributor, maintainer\n","program":{"html_id":"ameba/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"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,"const":false,"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"}],"types":[{"html_id":"ameba/Ameba","path":"Ameba.html","kind":"module","full_name":"Ameba","name":"Ameba","abstract":false,"locations":[{"filename":"src/ameba.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba.cr#L26"},{"filename":"src/ameba/glob_utils.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L1"},{"filename":"src/ameba/inline_comments.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L1"},{"filename":"src/ameba/issue.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L1"},{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L3"},{"filename":"src/ameba/runner.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L1"},{"filename":"src/ameba/severity.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L3"},{"filename":"src/ameba/source.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/support.cr#L7"},{"filename":"src/ameba/tokenizer.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/ameba/ameba/src\\\"`).chomp.stringify }}"}],"extended_modules":[{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"}],"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.

","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.

","abstract":false,"args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"args_string":"(config = Config.load)","args_html":"(config = Config.load)","location":{"filename":"src/ameba.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba.cr#L40"},"def":{"name":"run","args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"visibility":"Public","body":"(Runner.new(config)).run"}}],"types":[{"html_id":"ameba/Ameba/AST","path":"Ameba/AST.html","kind":"module","full_name":"Ameba::AST","name":"AST","abstract":false,"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L3"},{"filename":"src/ameba/ast/branchable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L3"},{"filename":"src/ameba/ast/flow_expression.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L3"},{"filename":"src/ameba/ast/scope.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L3"},{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L2"},{"filename":"src/ameba/ast/variabling/argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L1"},{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L4"},{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/ivariable.cr#L1"},{"filename":"src/ameba/ast/variabling/reference.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/reference.cr#L3"},{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L1"},{"filename":"src/ameba/ast/variabling/variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L1"},{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/flow_expression_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/scope_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","types":[{"html_id":"ameba/Ameba/AST/Argument","path":"Ameba/AST/Argument.html","kind":"class","full_name":"Ameba::AST::Argument","name":"Argument","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/variabling/argument.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the argument of some node.\nHolds the reference to the variable, thus to scope.\n\nFor example, all these vars are arguments:\n\n```\ndef method(a, b, c = 10, &block)\n 3.times do |i|\n end\n\n ->(x : Int32) {}\nend\n```","summary":"

Represents the argument of some node.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"visibility":"Public","body":"_ = allocate\n_.initialize(node, variable)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"anonymous?-instance-method","name":"anonymous?","doc":"Returns `true` if the `name` is empty, `false` otherwise.","summary":"

Returns true if the #name is empty, false otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L34"},"def":{"name":"anonymous?","visibility":"Public","body":"name.blank?"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L39"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L44"},"def":{"name":"name","visibility":"Public","body":"case current_node = node\nwhen Crystal::Var, 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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L17"},"def":{"name":"node","return_type":"Crystal::Var | Crystal::Arg","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L20"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/6d03cef/src/ameba/ast/variabling/assignment.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::Variable,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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|Nil-instance-method","name":"branch","doc":"Branch of this assignment.","summary":"

Branch of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L57"},"def":{"name":"in_branch?","visibility":"Public","body":"!branch.nil?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L47"},"def":{"name":"op_assign?","visibility":"Public","body":"node.is_a?(Crystal::OpAssign)"}},{"html_id":"referenced=(referenced:Bool)-instance-method","name":"referenced=","abstract":false,"args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"args_string":"(referenced : Bool)","args_html":"(referenced : Bool)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced=","args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"visibility":"Public","body":"@referenced = referenced"}},{"html_id":"referenced?:Bool-instance-method","name":"referenced?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","visibility":"Public","body":"@referenced"}},{"html_id":"referenced_in_loop?-instance-method","name":"referenced_in_loop?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L37"},"def":{"name":"referenced_in_loop?","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L62"},"def":{"name":"target_node","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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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 assignment.","summary":"

Variable of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L14"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::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","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L18"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L24"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"true"}}]},{"html_id":"ameba/Ameba/AST/Branch","path":"Ameba/AST/Branch.html","kind":"class","full_name":"Ameba::AST::Branch","name":"Branch","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the branch in Crystal code.\nBranch is a part of a branchable statement.\nFor example, the branchable if statement contains 3 branches:\n\n```\nif a = something # --> Branch A\n a = 1 # --> Branch B\n put a if out # --> Branch C\nelse\n do_something a # --> Branch D\nend\n```","summary":"

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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branch.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L66"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::ASTNode, scope : Scope)","args_html":"(node : Crystal::ASTNode, scope : Scope)","location":{"filename":"src/ameba/ast/branch.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L57"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"of(node, scope.node)"}}],"constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Ameba::AST::Branchable)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","args_html":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","location":{"filename":"src/ameba/ast/branch.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L34"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_loop?-instance-method","name":"in_loop?","doc":"Returns `true` if current branch is in a loop, `false` - otherwise.\nFor example, this branch is in a loop:\n\n```\nwhile true\n handle_input # this branch is in a loop\n if wrong_input\n show_message # this branch is also in a loop.\n end\nend\n```","summary":"

Returns true if current branch is in a loop, false - otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/branch.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L48"},"def":{"name":"in_loop?","visibility":"Public","body":"@parent.loop?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L18"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L21"},"def":{"name":"parent","return_type":"Branchable","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/6d03cef/src/ameba/ast/branchable.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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```\nwhile 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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Nil|Ameba::AST::Branchable=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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","args_html":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"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":"Array of branches","summary":"

Array of branches

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L22"},"def":{"name":"branches","visibility":"Public","body":"@branches"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L41"},"def":{"name":"loop?","visibility":"Public","body":"(loop?(node)) || (!(!parent.try(&.loop?)))"}},{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual Crystal node","summary":"

The actual Crystal node

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"parent:Branchable|Nil-instance-method","name":"parent","doc":"Parent branchable (if any)","summary":"

Parent branchable (if any)

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L19"},"def":{"name":"parent","return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_COMPLEXITY","name":"DEFAULT_COMPLEXITY","value":"1"}],"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

","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","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L9"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L19"},"def":{"name":"count","visibility":"Public","body":"@scope.accept(self)\n@complexity\n"}},{"html_id":"macro_condition?:Bool-instance-method","name":"macro_condition?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L6"},"def":{"name":"macro_condition?","visibility":"Public","body":"@macro_condition"}},{"html_id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","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":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L45"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"visibility":"Public","body":"@macro_condition = true\n@complexity = DEFAULT_COMPLEXITY\nfalse\n"}}]},{"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/6d03cef/src/ameba/ast/flow_expression.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,in_loop:Bool)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"args_string":"(node : Crystal::ASTNode, in_loop : Bool)","args_html":"(node : Crystal::ASTNode, in_loop : Bool)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L50"},"def":{"name":"unreachable_nodes","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 = (!(loop?(exp))) && (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"}}]},{"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/6d03cef/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

"},{"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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::InstanceVar)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/ivariable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"node:Crystal::InstanceVar-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{Alias, Assign, Block, Call, Case, ClassDef, ClassVar, Def, EnumDef, ExceptionHandler, Expressions, HashLiteral, If, InstanceVar, IsA, LibDef, ModuleDef, MultiAssign, NilLiteral, StringInterpolation, Unless, Until, Var, When, While}","doc":"List of nodes to be visited by Ameba's rules.","summary":"

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

"}],"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```","summary":"

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

","class_methods":[{"html_id":"category_to_node_classes(category:Category)-class-method","name":"category_to_node_classes","abstract":false,"args":[{"name":"category","external_name":"category","restriction":"Category"}],"args_string":"(category : Category)","args_html":"(category : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L47"},"def":{"name":"category_to_node_classes","args":[{"name":"category","external_name":"category","restriction":"Category"}],"visibility":"Public","body":"([] of Crystal::ASTNode.class).tap do |classes|\n if category.macro?\n classes.push(Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor)\n end\nend"}}],"constructors":[{"html_id":"new(rule,source,*,skip:Category)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"args_string":"(rule, source, *, skip : Category)","args_html":"(rule, source, *, skip : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L58"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(rule,source,*,skip:Array|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"args_string":"(rule, source, *, skip : Array | Nil = nil)","args_html":"(rule, source, *, skip : Array | Nil = nil)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L63"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"visit(node:Crystal::VisibilityModifier)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"args_string":"(node : Crystal::VisibilityModifier)","args_html":"(node : Crystal::VisibilityModifier)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L68"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"visibility":"Public","body":"node.exp.visibility = node.modifier\ntrue\n"}},{"html_id":"visit(node:Crystal::Alias)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Alias` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Alias node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(node : Crystal::Alias)","args_html":"(node : Crystal::Alias)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Assign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Assign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Assign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(node : Crystal::Assign)","args_html":"(node : Crystal::Assign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Block)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Block` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Block node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(node : Crystal::Block)","args_html":"(node : Crystal::Block)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Call)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Call` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Call node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(node : Crystal::Call)","args_html":"(node : Crystal::Call)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Case)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Case` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Case node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(node : Crystal::Case)","args_html":"(node : Crystal::Case)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(node : Crystal::ClassDef)","args_html":"(node : Crystal::ClassDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(node : Crystal::ClassVar)","args_html":"(node : Crystal::ClassVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Def)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Def` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Def node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(node : Crystal::Def)","args_html":"(node : Crystal::Def)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::EnumDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::EnumDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::EnumDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(node : Crystal::EnumDef)","args_html":"(node : Crystal::EnumDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ExceptionHandler)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ExceptionHandler` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ExceptionHandler node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(node : Crystal::ExceptionHandler)","args_html":"(node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Expressions` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Expressions node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(node : Crystal::Expressions)","args_html":"(node : Crystal::Expressions)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::HashLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::HashLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::HashLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(node : Crystal::HashLiteral)","args_html":"(node : Crystal::HashLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::If)-instance-method","name":"visit","doc":"A visit callback for `Crystal::If` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::If node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"args_string":"(node : Crystal::If)","args_html":"(node : Crystal::If)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::InstanceVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::InstanceVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::InstanceVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::IsA)-instance-method","name":"visit","doc":"A visit callback for `Crystal::IsA` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::IsA node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(node : Crystal::IsA)","args_html":"(node : Crystal::IsA)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::LibDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::LibDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::LibDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(node : Crystal::LibDef)","args_html":"(node : Crystal::LibDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ModuleDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ModuleDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ModuleDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(node : Crystal::ModuleDef)","args_html":"(node : Crystal::ModuleDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::MultiAssign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::MultiAssign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::MultiAssign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(node : Crystal::MultiAssign)","args_html":"(node : Crystal::MultiAssign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::NilLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::NilLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::NilLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(node : Crystal::NilLiteral)","args_html":"(node : Crystal::NilLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::StringInterpolation)-instance-method","name":"visit","doc":"A visit callback for `Crystal::StringInterpolation` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::StringInterpolation node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(node : Crystal::StringInterpolation)","args_html":"(node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Unless)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Unless` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Unless node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(node : Crystal::Unless)","args_html":"(node : Crystal::Unless)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Until)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Until` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Until node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(node : Crystal::Until)","args_html":"(node : Crystal::Until)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Var)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Var` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Var node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(node : Crystal::Var)","args_html":"(node : Crystal::Var)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::When)-instance-method","name":"visit","doc":"A visit callback for `Crystal::When` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::When node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"args_string":"(node : Crystal::When)","args_html":"(node : Crystal::When)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::While)-instance-method","name":"visit","doc":"A visit callback for `Crystal::While` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::While node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(node : Crystal::While)","args_html":"(node : Crystal::While)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":86,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L86"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"!(skip?(node))"}}],"types":[{"html_id":"ameba/Ameba/AST/NodeVisitor/Category","path":"Ameba/AST/NodeVisitor/Category.html","kind":"enum","full_name":"Ameba::AST::NodeVisitor::Category","name":"Category","abstract":false,"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/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L12"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Macro","name":"Macro","value":"1"},{"id":"None","name":"None","value":"0"},{"id":"All","name":"All","value":"1"}],"namespace":{"html_id":"ameba/Ameba/AST/NodeVisitor","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor"},"instance_methods":[{"html_id":"macro?-instance-method","name":"macro?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L13"},"def":{"name":"macro?","visibility":"Public","body":"self.includes?(Macro)"}},{"html_id":"none?-instance-method","name":"none?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L12"},"def":{"name":"none?","visibility":"Public","body":"value == 0"}}]}]},{"html_id":"ameba/Ameba/AST/RedundantControlExpressionVisitor","path":"Ameba/AST/RedundantControlExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::RedundantControlExpressionVisitor","name":"RedundantControlExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A class that utilizes a logic to traverse AST nodes and\nfire a source test callback if a redundant `Crystal::ControlExpression`\nis reached.","summary":"

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

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::Source,node:Crystal::ASTNode)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L15"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"A node to run traversal on.","summary":"

A node to run traversal on.

","abstract":false,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"def":{"name":"source","return_type":"Source","visibility":"Public","body":"@source"}}]},{"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/6d03cef/src/ameba/ast/variabling/reference.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","instance_methods":[{"html_id":"explicit=(explicit:Bool)-instance-method","name":"explicit=","abstract":false,"args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"args_string":"(explicit : Bool)","args_html":"(explicit : Bool)","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit=","args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"visibility":"Public","body":"@explicit = explicit"}},{"html_id":"explicit?:Bool-instance-method","name":"explicit?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit?","visibility":"Public","body":"@explicit"}}]},{"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/6d03cef/src/ameba/ast/scope.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,outer_scope:Nil|Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","args_html":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L47"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"add_argument(node)-instance-method","name":"add_argument","doc":"Creates a new argument in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_argument(arg_node)\n```","summary":"

Creates a new argument in the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L67"},"def":{"name":"add_argument","args":[{"name":"node","external_name":"node","restriction":""}],"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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L78"},"def":{"name":"add_ivariable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"ivariables << (InstanceVariable.new(node))"}},{"html_id":"add_type_dec_variable(node)-instance-method","name":"add_type_dec_variable","doc":"Adds a new type declaration variable to the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_type_dec_variable(node)\n```","summary":"

Adds a new type declaration variable to the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":88,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L88"},"def":{"name":"add_type_dec_variable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"type_dec_variables << (TypeDecVariable.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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L57"},"def":{"name":"add_variable","args":[{"name":"node","external_name":"node","restriction":""}],"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` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"var","external_name":"var","restriction":""}],"args_string":"(var)","args_html":"(var)","location":{"filename":"src/ameba/ast/scope.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L199"},"def":{"name":"arg?","args":[{"name":"var","external_name":"var","restriction":""}],"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L20"},"def":{"name":"arguments","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","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"args_string":"(name, node)","args_html":"(name, node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":109,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L109"},"def":{"name":"assign_variable","args":[{"name":"name","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(find_variable(name)).try(&.assign(node, self))"}},{"html_id":"assigns_ivar?(name)-instance-method","name":"assigns_ivar?","doc":"Returns `true` if instance variable is assigned in this scope.","summary":"

Returns true if instance variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":140,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L140"},"def":{"name":"assigns_ivar?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"arguments.any?() do |__arg7|\n __arg7.name == name\nend && ivariables.any?() do |__arg8|\n __arg8.name == \"@#{name}\"\nend"}},{"html_id":"assigns_type_dec?(name)-instance-method","name":"assigns_type_dec?","doc":"Returns `true` if type declaration variable is assigned in this scope.","summary":"

Returns true if type declaration variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L146"},"def":{"name":"assigns_type_dec?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"type_dec_variables.any?() do |__arg9|\n __arg9.name == name\nend || (!(!outer_scope.try(&.assigns_type_dec?(name))))"}},{"html_id":"block?-instance-method","name":"block?","doc":"Returns `true` if current scope represents a block (or proc),\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L115"},"def":{"name":"block?","visibility":"Public","body":"node.is_a?(Crystal::Block) || node.is_a?(Crystal::ProcLiteral)"}},{"html_id":"class_def?(*,check_outer_scopes=false)-instance-method","name":"class_def?","doc":"Returns `true` if current scope is a class def, `false` otherwise.","summary":"

Returns true if current scope is a class def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"class_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ClassDef) || (!(!(check_outer_scopes && outer_scope.try(&.class_def?(check_outer_scopes: true)))))"}},{"html_id":"def?(*,check_outer_scopes=false)-instance-method","name":"def?","doc":"Returns `true` if current scope is a def, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::Def) || (!(!(check_outer_scopes && outer_scope.try(&.def?(check_outer_scopes: true)))))"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enum_def?(*,check_outer_scopes=false)-instance-method","name":"enum_def?","doc":"Returns `true` if current scope is a enum def, `false` otherwise.","summary":"

Returns true if current scope is a enum def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"enum_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::EnumDef) || (!(!(check_outer_scopes && outer_scope.try(&.enum_def?(check_outer_scopes: true)))))"}},{"html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns `true` if the *node* represents exactly\nthe same Crystal node as `@node`.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":218,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L218"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node == @node) && node.location) && (node.location == @node.location)"}},{"html_id":"find_variable(name:String)-instance-method","name":"find_variable","doc":"Returns variable by its name or `nil` if it does not exist.\n\n```\nscope = Scope.new(class_node, nil)\nscope.find_variable(\"foo\")\n```","summary":"

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

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/ast/scope.cr","line_number":98,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L98"},"def":{"name":"find_variable","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"variables.find() do |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"fun_def?(*,check_outer_scopes=false)-instance-method","name":"fun_def?","doc":"Returns `true` if current scope is a fun def, `false` otherwise.","summary":"

Returns true if current scope is a fun def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"fun_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::FunDef) || (!(!(check_outer_scopes && outer_scope.try(&.fun_def?(check_outer_scopes: true)))))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_macro?-instance-method","name":"in_macro?","doc":"Returns `true` if current scope sits inside a macro.","summary":"

Returns true if current scope sits inside a macro.

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":132,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L132"},"def":{"name":"in_macro?","visibility":"Public","body":"((node.is_a?(Crystal::Macro) || node.is_a?(Crystal::MacroIf)) || node.is_a?(Crystal::MacroFor)) || (!(!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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L32"},"def":{"name":"inner_scopes","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L23"},"def":{"name":"ivariables","visibility":"Public","body":"@ivariables"}},{"html_id":"lib_def?(*,check_outer_scopes=false)-instance-method","name":"lib_def?","doc":"Returns `true` if current scope is a lib def, `false` otherwise.","summary":"

Returns true if current scope is a lib def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"lib_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::LibDef) || (!(!(check_outer_scopes && outer_scope.try(&.lib_def?(check_outer_scopes: true)))))"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"module_def?(*,check_outer_scopes=false)-instance-method","name":"module_def?","doc":"Returns `true` if current scope is a module def, `false` otherwise.","summary":"

Returns true if current scope is a module def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"module_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ModuleDef) || (!(!(check_outer_scopes && outer_scope.try(&.module_def?(check_outer_scopes: true)))))"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L35"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"outer_scope:Scope|Nil-instance-method","name":"outer_scope","doc":"Link to the outer scope","summary":"

Link to the outer scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L29"},"def":{"name":"outer_scope","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L17"},"def":{"name":"references","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,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","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":165,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L165"},"def":{"name":"references?","args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"variable.references.any? do |reference|\n (reference.scope == self) || (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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":127,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L127"},"def":{"name":"spawn_block?","visibility":"Public","body":"(node.as?(Crystal::Block)).try(&.call).try(&.name) == \"spawn\""}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":194,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L194"},"def":{"name":"top_level?","visibility":"Public","body":"outer_scope.nil?"}},{"html_id":"type_dec_variables:Array(Ameba::AST::TypeDecVariable)-instance-method","name":"type_dec_variables","doc":"Link to the type declaration variables used in current scope","summary":"

Link to the type declaration variables used in current scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L26"},"def":{"name":"type_dec_variables","visibility":"Public","body":"@type_dec_variables"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":153,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L153"},"def":{"name":"type_definition?","visibility":"Public","body":"(((((node.is_a?(Crystal::ClassDef) || node.is_a?(Crystal::ModuleDef)) || node.is_a?(Crystal::EnumDef)) || 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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L14"},"def":{"name":"variables","visibility":"Public","body":"@variables"}},{"html_id":"visibility-instance-method","name":"visibility","doc":"Returns visibility of the current scope (could be inherited from the outer scope).","summary":"

Returns visibility of the current scope (could be inherited from the outer scope).

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":179,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L179"},"def":{"name":"visibility","visibility":"Public","body":"@visibility || outer_scope.try(&.visibility)"}},{"html_id":"visibility=(visibility:Crystal::Visibility|Nil)-instance-method","name":"visibility=","doc":"Scope visibility level","summary":"

Scope visibility level

","abstract":false,"args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"args_string":"(visibility : Crystal::Visibility | Nil)","args_html":"(visibility : Crystal::Visibility | Nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L11"},"def":{"name":"visibility=","args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"visibility":"Public","body":"@visibility = visibility"}},{"html_id":"yields=(yields:Bool)-instance-method","name":"yields=","doc":"Whether the scope yields.","summary":"

Whether the scope yields.

","abstract":false,"args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"args_string":"(yields : Bool)","args_html":"(yields : Bool)","location":{"filename":"src/ameba/ast/scope.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L8"},"def":{"name":"yields=","args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"visibility":"Public","body":"@yields = yields"}},{"html_id":"yields?(check_inner_scopes=true)-instance-method","name":"yields?","doc":"Returns `true` if current scope (or any of inner scopes) yields,\n`false` otherwise.","summary":"

Returns true if current scope (or any of inner scopes) yields, false otherwise.

","abstract":false,"args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(check_inner_scopes = true)","args_html":"(check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L174"},"def":{"name":"yields?","args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"@yields || (check_inner_scopes && inner_scopes.any?(&.yields?))"}}]},{"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/6d03cef/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{ClassDef, ModuleDef, EnumDef, LibDef, FunDef, TypeDef, TypeOf, CStructOrUnionDef, ProcLiteral, Block, Macro, MacroIf, MacroFor}","doc":"Non-exhaustive list of nodes to be visited by Ameba's rules.","summary":"

Non-exhaustive list of nodes to be visited by Ameba's rules.

"},{"id":"SPECIAL_NODE_NAMES","name":"SPECIAL_NODE_NAMES","value":"[\"super\", \"previous_def\"] of ::String"}],"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.

","constructors":[{"html_id":"new(rule,source,skip=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","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/scope_visitor.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/scope_visitor.cr#L31"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"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/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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","abstract":false,"location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is `Crystal::Expressions`,\nthen always traverse the children.","summary":"

If a top level node is Crystal::Expressions, then always traverse the children.

","abstract":false,"args":[{"name":"node","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L20"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L26"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"false"}}]},{"html_id":"ameba/Ameba/AST/TypeDecVariable","path":"Ameba/AST/TypeDecVariable.html","kind":"class","full_name":"Ameba::AST::TypeDecVariable","name":"TypeDecVariable","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/type_dec_variable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::TypeDeclaration)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"args_string":"(node : Crystal::TypeDeclaration)","args_html":"(node : Crystal::TypeDeclaration)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name-instance-method","name":"name","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L11"},"def":{"name":"name","visibility":"Public","body":"case var = @node.var\nwhen Crystal::Var, Crystal::InstanceVar, Crystal::ClassVar, Crystal::Global\n var.name\nelse\n raise(\"Unsupported var node type: #{var.class}\")\nend"}},{"html_id":"node:Crystal::TypeDeclaration-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L3"},"def":{"name":"node","return_type":"Crystal::TypeDeclaration","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"html_id":"ameba/Ameba/AST/Util","path":"Ameba/AST/Util.html","kind":"module","full_name":"Ameba::AST::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/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/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"}],"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.

","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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L180"},"def":{"name":"abort?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"abort\")) && node.args.size <= 2) && node.obj.nil?"}},{"html_id":"control_exp_code(node:Crystal::ControlExpression,code_lines)-instance-method","name":"control_exp_code","doc":"Returns the exp code of a control expression.\nWraps implicit tuple literal with curly brackets (e.g. multi-return).","summary":"

Returns the exp code of a control expression.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node : Crystal::ControlExpression, code_lines)","args_html":"(node : Crystal::ControlExpression, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L199"},"def":{"name":"control_exp_code","args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"visibility":"Public","body":"if exp = node.exp\nelse\n return\nend\nif exp_code = node_source(exp, code_lines)\nelse\n return\nend\nif exp.is_a?(Crystal::TupleLiteral) && (exp_code[0] != '{')\nelse\n return exp_code\nend\nif exp_start = exp.elements.first.location\nelse\n return\nend\nif exp_end = exp.end_location\nelse\n return\nend\n\"{#{source_between(exp_start, exp_end, code_lines)}}\"\n"}},{"html_id":"dynamic_literal?(node):Bool-instance-method","name":"dynamic_literal?","doc":"Returns `true` if current `node` is a dynamic literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L48"},"def":{"name":"dynamic_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && (!is_static)\n"}},{"html_id":"exit?(node)-instance-method","name":"exit?","doc":"Returns `true` if node represents `exit` method call.","summary":"

Returns true if node represents exit method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L174"},"def":{"name":"exit?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"exit\")) && node.args.size <= 1) && node.obj.nil?"}},{"html_id":"flow_command?(node,in_loop)-instance-method","name":"flow_command?","doc":"Returns `true` if node is a flow command, `false` otherwise.\nNode represents a flow command if it is a control expression,\nor special call node that interrupts execution (i.e. raise, exit, abort).","summary":"

Returns true if node is a flow command, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/util.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L102"},"def":{"name":"flow_command?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"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","external_name":"node","restriction":""},{"name":"in_loop","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":140,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L140"},"def":{"name":"flow_expression?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","default_value":"false","external_name":"in_loop","restriction":""}],"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):Bool-instance-method","name":"literal?","doc":"Returns `true` if current `node` is a literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L54"},"def":{"name":"literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, _ = literal_kind?(node)\nis_literal\n"}},{"html_id":"loop?(node)-instance-method","name":"loop?","doc":"Returns `true` if node represents a loop.","summary":"

Returns true if node represents a loop.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":186,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L186"},"def":{"name":"loop?","args":[{"name":"node","external_name":"node","restriction":""}],"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":"name_end_location(node)-instance-method","name":"name_end_location","doc":"Returns `nil` if *node* does not contain a name.\n\nNOTE: Use this instead of `Crystal::Call#name_end_location` to avoid an\n off-by-one error.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":242,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L242"},"def":{"name":"name_end_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = name_location(node)\nelse\n return\nend\nif (size = name_size(node)).zero?\n return\nend\nloc.adjust(column_number: size - 1)\n"}},{"html_id":"name_location(node)-instance-method","name":"name_location","doc":"Returns `nil` if *node* does not contain a name.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":210,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L210"},"def":{"name":"name_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = node.name_location\n return loc\nend\nif node.is_a?(Crystal::TypeDeclaration) || node.is_a?(Crystal::UninitializedVar)\n return node.var.location\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return\nend\nif name.is_a?(Crystal::ASTNode)\nelse\n return\nend\nname.location\n"}},{"html_id":"name_size(node)-instance-method","name":"name_size","doc":"Returns zero if *node* does not contain a name.","summary":"

Returns zero if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":224,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L224"},"def":{"name":"name_size","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if (size = node.name_size).zero?\nelse\n return size\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return 0\nend\ncase name\nwhen Crystal::ASTNode\n name.name_size\nwhen Crystal::Token::Kind\n name.to_s.size\nelse\n name.size\nend\n"}},{"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","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node, code_lines)","args_html":"(node, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L69"},"def":{"name":"node_source","args":[{"name":"node","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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":"path_named?(node,name):Bool-instance-method","name":"path_named?","doc":"Returns `true` if current `node` is a `Crystal::Path`\nmatching given *name*, `false` otherwise.","summary":"

Returns true if current node is a Crystal::Path matching given name, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"args_string":"(node, name) : Bool","args_html":"(node, name) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L61"},"def":{"name":"path_named?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"return_type":"Bool","visibility":"Public","body":"node.is_a?(Crystal::Path) && (name == (node.names.join(\"::\")))"}},{"html_id":"raise?(node)-instance-method","name":"raise?","doc":"Returns `true` if node represents `raise` method call.","summary":"

Returns true if node represents raise method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":168,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L168"},"def":{"name":"raise?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"raise\")) && (node.args.size == 1)) && node.obj.nil?"}},{"html_id":"source_between(loc,end_loc,code_lines):String|Nil-instance-method","name":"source_between","doc":"Returns the source code from *loc* to *end_loc* (inclusive).","summary":"

Returns the source code from loc to end_loc (inclusive).

","abstract":false,"args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String | Nil","args_html":"(loc, end_loc, code_lines) : String | Nil","location":{"filename":"src/ameba/ast/util.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L77"},"def":{"name":"source_between","args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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"}},{"html_id":"static_literal?(node):Bool-instance-method","name":"static_literal?","doc":"Returns `true` if current `node` is a static literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L42"},"def":{"name":"static_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && is_static\n"}}]},{"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/6d03cef/src/ameba/ast/variabling/variable.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/AST/Reference","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference"}],"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 assignments.","summary":"

Represents the existence of the local variable.

","constructors":[{"html_id":"new(node:Crystal::Var,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::Var, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::Var, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L28"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L45"},"def":{"name":"assign","args":[{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"visibility":"Public","body":"assignments << (Assignment.new(node, self, scope))\nupdate_assign_reference!\n"}},{"html_id":"assign_before_reference:Crystal::ASTNode|Nil-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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L18"},"def":{"name":"assign_before_reference","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 assignments of this variable.","summary":"

List of the assignments of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","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","default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":114,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L114"},"def":{"name":"captured_by_block?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":163,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L163"},"def":{"name":"declared_before?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"var_location, node_location = location, node.location\nif var_location && node_location\nelse\n return\nend\n(var_location.line_number < node_location.line_number) || ((var_location.line_number == node_location.line_number) && var_location.column_number < node_location.column_number)\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L156"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(node.is_a?(Crystal::Var) && (node.name == @node.name)) && (node.location == @node.location)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":150,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L150"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","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","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","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":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L68"},"def":{"name":"reference","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"(Reference.new(node, scope)).tap do |reference|\n references << reference\n scope.references << reference\nend"}},{"html_id":"reference(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":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(scope : Scope)","args_html":"(scope : Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L76"},"def":{"name":"reference","args":[{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"reference(node, scope)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L87"},"def":{"name":"reference_assignments!","visibility":"Public","body":"consumed_branches = Set(Branch).new\nassignments.reverse_each do |assignment|\n if assignment.branch.in?(consumed_branches)\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, some_scope)\nvariable.referenced? # => true\n```","summary":"

Returns true if variable has any reference.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L58"},"def":{"name":"referenced?","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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","visibility":"Public","body":"@references"}},{"html_id":"scope:Scope-instance-method","name":"scope","doc":"Scope of this variable.","summary":"

Scope of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","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 $?.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L32"},"def":{"name":"special?","visibility":"Public","body":"@node.special_var?"}},{"html_id":"target_of?(assign)-instance-method","name":"target_of?","doc":"Returns `true` if the variable is a target (on the left) of the assignment,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"assign","external_name":"assign","restriction":""}],"args_string":"(assign)","args_html":"(assign)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":138,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L138"},"def":{"name":"target_of?","args":[{"name":"assign","external_name":"assign","restriction":""}],"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 |target|\n eql?(target)\n end\nwhen Crystal::UninitializedVar\n eql?(assign.var)\nelse\n false\nend"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` if not.","summary":"

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

","abstract":false,"args":[{"name":"scope","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":126,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L126"},"def":{"name":"used_in_macro?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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"}}]}]},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L37"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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}"},{"id":"DEFAULT_GLOBS","name":"DEFAULT_GLOBS","value":"[\"**/*.cr\", \"!lib\"] of ::String"},{"id":"DEFAULT_PATH","name":"DEFAULT_PATH","value":"Path[Dir.current] / FILENAME"},{"id":"DEFAULT_PATHS","name":"DEFAULT_PATHS","value":"{Path[\"~\"] / FILENAME, Path[XDG_CONFIG_HOME] / \"ameba/config.yml\"}"},{"id":"FILENAME","name":"FILENAME","value":"\".ameba.yml\""},{"id":"XDG_CONFIG_HOME","name":"XDG_CONFIG_HOME","value":"ENV.fetch(\"XDG_CONFIG_HOME\", \"~/.config\")"}],"included_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"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 located in a current\nworking directory.\n\nIf it cannot be found until reaching the root directory, then it will be\nsearched for in the user’s global config locations, which consists of a\ndotfile or a config file inside the XDG Base Directory specification.\n\n- `~/.ameba.yml`\n- `$XDG_CONFIG_HOME/ameba/config.yml` (expands to `~/.config/ameba/config.yml`\n if `$XDG_CONFIG_HOME` is not set)\n\nIf both files exist, the dotfile will be selected.\n\nAs an example, if Ameba is invoked from inside `/path/to/project/lib/utils`,\nthen it will use the config as specified inside the first of the following files:\n\n- `/path/to/project/lib/utils/.ameba.yml`\n- `/path/to/project/lib/.ameba.yml`\n- `/path/to/project/.ameba.yml`\n- `/path/to/.ameba.yml`\n- `/path/.ameba.yml`\n- `/.ameba.yml`\n- `~/.ameba.yml`\n- `~/.config/ameba/config.yml`","summary":"

A configuration entry for Ameba::Runner.

","class_methods":[{"html_id":"formatter_names-class-method","name":"formatter_names","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":145,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L145"},"def":{"name":"formatter_names","visibility":"Public","body":"AVAILABLE_FORMATTERS.keys.join('|')"}},{"html_id":"load(path=nil,colors=true,skip_reading_config=false)-class-method","name":"load","doc":"Loads YAML configuration file by `path`.\n\n```\nconfig = Ameba::Config.load\n```","summary":"

Loads YAML configuration file by path.

","abstract":false,"args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"args_string":"(path = nil, colors = true, skip_reading_config = false)","args_html":"(path = nil, colors = true, skip_reading_config = false)","location":{"filename":"src/ameba/config.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L110"},"def":{"name":"load","args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"visibility":"Public","body":"begin\n Colorize.enabled = colors\n content = if skip_reading_config\n \"{}\"\n else\n (read_config(path)) || \"{}\"\n end\n Config.new(YAML.parse(content))\nrescue e\n raise(\"Unable to load config file: #{e.message}\")\nend"}}],"instance_methods":[{"html_id":"autocorrect=(autocorrect:Bool)-instance-method","name":"autocorrect=","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"args_string":"(autocorrect : Bool)","args_html":"(autocorrect : Bool)","location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L87"},"def":{"name":"autocorrect=","args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"visibility":"Public","body":"@autocorrect = autocorrect"}},{"html_id":"autocorrect?:Bool-instance-method","name":"autocorrect?","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L87"},"def":{"name":"autocorrect?","visibility":"Public","body":"@autocorrect"}},{"html_id":"excluded:Array(String)-instance-method","name":"excluded","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L84"},"def":{"name":"excluded","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","external_name":"excluded","restriction":"Array(String)"}],"args_string":"(excluded : Array(String))","args_html":"(excluded : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L84"},"def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String)"}],"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L171"},"def":{"name":"formatter","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","external_name":"name","restriction":"String | Symbol"}],"args_string":"(name : String | Symbol)","args_html":"(name : String | Symbol)","location":{"filename":"src/ameba/config.cr","line_number":181,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L181"},"def":{"name":"formatter=","args":[{"name":"name","external_name":"name","restriction":"String | Symbol"}],"visibility":"Public","body":"if formatter = AVAILABLE_FORMATTERS[name]?\nelse\n raise(\"Unknown formatter `#{name}`. Use one of #{Config.formatter_names}.\")\nend\n@formatter = formatter.new\n"}},{"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L171"},"def":{"name":"formatter=","args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L75"},"def":{"name":"globs","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","external_name":"globs","restriction":"Array(String)"}],"args_string":"(globs : Array(String))","args_html":"(globs : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L75"},"def":{"name":"globs=","args":[{"name":"globs","external_name":"globs","restriction":"Array(String)"}],"visibility":"Public","body":"@globs = globs"}},{"html_id":"rules:Array(Rule::Base)-instance-method","name":"rules","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L63"},"def":{"name":"rules","return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L64"},"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L64"},"def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L158"},"def":{"name":"sources","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","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":194,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L194"},"def":{"name":"update_rule","args":[{"name":"name","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L215"},"def":{"name":"update_rules","args":[{"name":"names","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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)"}}]},{"html_id":"ameba/Ameba/Ext","path":"Ameba/Ext.html","kind":"module","full_name":"Ameba::Ext","name":"Ext","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Ext/Location","path":"Ameba/Ext/Location.html","kind":"module","full_name":"Ameba::Ext::Location","name":"Location","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"ameba/Crystal/Location","kind":"class","full_name":"Crystal::Location","name":"Location"}],"namespace":{"html_id":"ameba/Ameba/Ext","kind":"module","full_name":"Ameba::Ext","name":"Ext"},"doc":"Extensions to Crystal::Location","summary":"

Extensions to Crystal::Location

","instance_methods":[{"html_id":"adjust(line_number=0,column_number=0):self-instance-method","name":"adjust","doc":"Returns the same location as this location but with the line and/or column number(s) adjusted\nby the given amount(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) adjusted by the given amount(s).

","abstract":false,"args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"args_string":"(line_number = 0, column_number = 0) : self","args_html":"(line_number = 0, column_number = 0) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L11"},"def":{"name":"adjust","args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, @line_number + line_number, @column_number + column_number)"}},{"html_id":"seek(offset:self):self-instance-method","name":"seek","doc":"Seeks to a given *offset* relative to `self`.","summary":"

Seeks to a given offset relative to self.

","abstract":false,"args":[{"name":"offset","external_name":"offset","restriction":"self"}],"args_string":"(offset : self) : self","args_html":"(offset : self) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L16"},"def":{"name":"seek","args":[{"name":"offset","external_name":"offset","restriction":"self"}],"return_type":"self","visibility":"Public","body":"if (offset.filename.as?(String)).presence && (@filename != offset.filename)\n raise(ArgumentError.new(\"Mismatching filenames:\\n #{@filename}\\n #{offset.filename}\"))\nend\nif offset.line_number == 1\n self.class.new(@filename, @line_number, (@column_number + offset.column_number) - 1)\nelse\n self.class.new(@filename, (@line_number + offset.line_number) - 1, offset.column_number)\nend\n"}},{"html_id":"with(line_number=@line_number,column_number=@column_number):self-instance-method","name":"with","doc":"Returns the same location as this location but with the line and/or column number(s) changed\nto the given value(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) changed to the given value(s).

","abstract":false,"args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"args_string":"(line_number = @line_number, column_number = @column_number) : self","args_html":"(line_number = @line_number, column_number = @column_number) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L5"},"def":{"name":"with","args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, line_number, column_number)"}}]}]},{"html_id":"ameba/Ameba/Formatter","path":"Ameba/Formatter.html","kind":"module","full_name":"Ameba::Formatter","name":"Formatter","abstract":false,"locations":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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/6d03cef/src/ameba/formatter/base_formatter.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/base_formatter.cr#L13"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","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","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/6d03cef/src/ameba/formatter/base_formatter.cr#L30"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/base_formatter.cr#L10"},"def":{"name":"output","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","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/6d03cef/src/ameba/formatter/base_formatter.cr#L26"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":""}},{"html_id":"source_started(source:Source)-instance-method","name":"source_started","doc":"Callback that indicates when source inspection is started.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is started.

","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/formatter/base_formatter.cr#L22"},"def":{"name":"source_started","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/6d03cef/src/ameba/formatter/base_formatter.cr#L18"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":""}}]},{"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/6d03cef/src/ameba/formatter/disabled_formatter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/6d03cef/src/ameba/formatter/disabled_formatter.cr#L4"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"output << \"Disabled rules using inline directives:\\n\\n\"\nsources.each do |source|\n source.issues.select(&.disabled?).each do |issue|\n if loc = issue.location\n else\n next\n end\n output << (\"#{source.path}:#{loc.line_number}\".colorize(:cyan))\n output << \" #{issue.rule.name}\\n\"\n end\nend\n"}}]},{"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/6d03cef/src/ameba/formatter/dot_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"subclasses":[{"html_id":"ameba/Ameba/Formatter/TODOFormatter","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter"}],"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.

","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","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/6d03cef/src/ameba/formatter/dot_formatter.cr#L27"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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.print(location.colorize(:cyan))\n if issue.correctable?\n if config[:autocorrect]?\n output.print(\" [Corrected]\".colorize(:green))\n else\n output.print(\" [Correctable]\".colorize(:yellow))\n end\n end\n output.puts\n output.puts((\"[%s] %s: %s\" % {issue.rule.severity.symbol, issue.rule.name, issue.message}).colorize(issue.rule.severity.color))\n if show_affected_code && (code = affected_code(issue))\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","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/6d03cef/src/ameba/formatter/dot_formatter.cr#L21"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/6d03cef/src/ameba/formatter/dot_formatter.cr#L13"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@started_at = Time.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\n"}}]},{"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/6d03cef/src/ameba/formatter/explain_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(output:IO,location)-class-method","name":"new","doc":"Creates a new instance of `ExplainFormatter`.\n\nAccepts *output* which indicates the io where the explanation will be written to.\nSecond argument is *location* which indicates the location to explain.\n\n```\nExplainFormatter.new output, {\n file: path,\n line: line_number,\n column: column_number,\n}\n```","summary":"

Creates a new instance of ExplainFormatter.

","abstract":false,"args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"args_string":"(output : IO, location)","args_html":"(output : IO, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L24"},"def":{"name":"new","args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"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 explanations at the *@location*.","summary":"

Reports the explanations at the @location.

","abstract":false,"args":[{"name":"sources","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L33"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L10"},"def":{"name":"location","return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L9"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"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/6d03cef/src/ameba/formatter/flycheck_formatter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"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","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/6d03cef/src/ameba/formatter/flycheck_formatter.cr#L5"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n if loc = issue.location\n else\n next\n end\n @mutex.synchronize do\n output.printf(\"%s:%d:%d: %s: [%s] %s\\n\", source.path, loc.line_number, loc.column_number, issue.rule.severity.symbol, issue.rule.name, issue.message.gsub('\\n', \" \"))\n end\nend"}}]},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L65"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

A formatter that produces the result in a json format.

","constructors":[{"html_id":"new(output=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","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":66,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L66"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":94,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L94"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L74"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"json_source = AsJSON::Source.new(source.path)\nsource.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n json_source.issues << (AsJSON::Issue.new(issue.rule.name, issue.rule.severity.to_s, issue.location, issue.end_location, issue.message))\n __temp_54 = @result.summary\n __temp_54.issues_count = __temp_54.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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L70"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@result.summary.target_sources_count = sources.size"}}]},{"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/6d03cef/src/ameba/formatter/todo_formatter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(output=STDOUT,config_path:Path=Config::DEFAULT_PATH)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"args_string":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","args_html":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/todo_formatter.cr#L6"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output, config_path)\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","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/6d03cef/src/ameba/formatter/todo_formatter.cr#L9"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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\n(generate_todo_config(issues)).tap do |file|\n @output.puts(\"Created #{file.path}\")\nend\n"}}]},{"html_id":"ameba/Ameba/Formatter/Util","path":"Ameba/Formatter/Util.html","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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"},"instance_methods":[{"html_id":"affected_code(issue:Issue,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L45"},"def":{"name":"affected_code","args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"if location = issue.location\nelse\n return\nend\naffected_code(issue.code, location, issue.end_location, context_lines, max_length, ellipsis, prompt)\n"}},{"html_id":"affected_code(code,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L51"},"def":{"name":"affected_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"lines = code.split('\\n')\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","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","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":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L19"},"def":{"name":"context","args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","default_value":"true","external_name":"remove_empty","restriction":""}],"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|Nil):String|Nil-instance-method","name":"deansify","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String | Nil) : String | Nil","args_html":"(message : String | Nil) : String | Nil","location":{"filename":"src/ameba/formatter/util.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L5"},"def":{"name":"deansify","args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"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","abstract":false,"args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L9"},"def":{"name":"trim","args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"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"}}]}]},{"html_id":"ameba/Ameba/GlobUtils","path":"Ameba/GlobUtils.html","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils","abstract":false,"locations":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"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.

","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","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L24"},"def":{"name":"expand","args":[{"name":"globs","external_name":"globs","restriction":""}],"visibility":"Public","body":"globs.flat_map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.uniq!.select! do |path|\n File.file?(path)\nend"}},{"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","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L12"},"def":{"name":"find_files_by_globs","args":[{"name":"globs","external_name":"globs","restriction":""}],"visibility":"Public","body":"rejected = rejected_globs(globs)\nselected = globs - rejected\n(expand(selected)) - (expand(rejected.map!(&.[](1..-1))))\n"}}]},{"html_id":"ameba/Ameba/InlineComments","path":"Ameba/InlineComments.html","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments","abstract":false,"locations":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COMMENT_DIRECTIVE_REGEX","name":"COMMENT_DIRECTIVE_REGEX","value":"/# ameba:(?\\w+) (?\\w+(?:\\/\\w+)?(?:,? \\w+(?:\\/\\w+)?)*)/"}],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes inline comments parsing and processing logic.","summary":"

A module that utilizes inline comments parsing and processing logic.

","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.

","abstract":false,"args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"args_string":"(line_number : Int32)","args_html":"(line_number : Int32)","location":{"filename":"src/ameba/inline_comments.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L78"},"def":{"name":"comment?","args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"visibility":"Public","body":"if line = lines[line_number]?\nelse\n return\nend\ncomment?(line)\n"}},{"html_id":"location_disabled?(location:Crystal::Location|Nil,rule)-instance-method","name":"location_disabled?","doc":"Returns `true` if current location is disabled for a particular rule,\n`false` otherwise.\n\nLocation is disabled in two cases:\n 1. The line of the location ends with a comment directive.\n 2. The line above the location is a comment directive.\n\nFor example, here are two examples of disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\nTime.epoch(1483859302)\n\nTime.epoch(1483859302) # ameba:disable Style/LargeNumbers\n```\n\nBut here are examples which are not considered as disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\n#\nTime.epoch(1483859302)\n\nif use_epoch? # ameba:disable Style/LargeNumbers\n Time.epoch(1483859302)\nend\n```","summary":"

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

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(location : Crystal::Location | Nil, rule)","args_html":"(location : Crystal::Location | Nil, rule)","location":{"filename":"src/ameba/inline_comments.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L40"},"def":{"name":"location_disabled?","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"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","external_name":"line","restriction":""}],"args_string":"(line)","args_html":"(line)","location":{"filename":"src/ameba/inline_comments.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L68"},"def":{"name":"parse_inline_directive","args":[{"name":"line","external_name":"line","restriction":""}],"visibility":"Public","body":"if directive = COMMENT_DIRECTIVE_REGEX.match(line)\nelse\n return\nend\nif commented_out?(line.gsub(directive[0], \"\"))\n return\nend\n{action: directive[\"action\"], rules: directive[\"rules\"].split(/[\\s,]/, remove_empty: true)}\n"}}],"types":[{"html_id":"ameba/Ameba/InlineComments/Action","path":"Ameba/InlineComments/Action.html","kind":"enum","full_name":"Ameba::InlineComments::Action","name":"Action","abstract":false,"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":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L8"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Disable","name":"Disable","value":"0"},{"id":"Enable","name":"Enable","value":"1"}],"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

","instance_methods":[{"html_id":"disable?-instance-method","name":"disable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L9"},"def":{"name":"disable?","visibility":"Public","body":"self == Disable"}},{"html_id":"enable?-instance-method","name":"enable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L10"},"def":{"name":"enable?","visibility":"Public","body":"self == Enable"}}]}]},{"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/6d03cef/src/ameba/issue.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(code:String,rule:Ameba::Rule::Base,location:Nil|Crystal::Location,end_location:Nil|Crystal::Location,message:String,status:Status|Nil=nil,block:Source::Corrector->|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","args_html":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","location":{"filename":"src/ameba/issue.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L30"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, rule, location, end_location, message, status, block)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","doc":"The source code that triggered this issue.","summary":"

The source code that triggered this issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L10"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct(corrector)-instance-method","name":"correct","abstract":false,"args":[{"name":"corrector","external_name":"corrector","restriction":""}],"args_string":"(corrector)","args_html":"(corrector)","location":{"filename":"src/ameba/issue.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L42"},"def":{"name":"correct","args":[{"name":"corrector","external_name":"corrector","restriction":""}],"visibility":"Public","body":"@block.try(&.call(corrector))"}},{"html_id":"correctable?-instance-method","name":"correctable?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L38"},"def":{"name":"correctable?","visibility":"Public","body":"!@block.nil?"}},{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location|Nil-instance-method","name":"end_location","doc":"End location of the issue.","summary":"

End location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L19"},"def":{"name":"end_location","return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@end_location"}},{"html_id":"location:Crystal::Location|Nil-instance-method","name":"location","doc":"Location of the issue.","summary":"

Location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L16"},"def":{"name":"location","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,"location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L22"},"def":{"name":"message","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,"location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L13"},"def":{"name":"rule","return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"

Issue status.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L25"},"def":{"name":"status","return_type":"Status","visibility":"Public","body":"@status"}},{"html_id":"syntax?-instance-method","name":"syntax?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L34"},"def":{"name":"syntax?","visibility":"Public","body":"rule.is_a?(Rule::Lint::Syntax)"}}],"types":[{"html_id":"ameba/Ameba/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","abstract":false,"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/6d03cef/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0"},{"id":"Disabled","name":"Disabled","value":"1"}],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"instance_methods":[{"html_id":"disabled?-instance-method","name":"disabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","visibility":"Public","body":"self == Enabled"}}]}]},{"html_id":"ameba/Ameba/Presenter","path":"Ameba/Presenter.html","kind":"module","full_name":"Ameba::Presenter","name":"Presenter","abstract":false,"locations":[{"filename":"src/ameba/presenter/base_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_collection_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_presenter.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","path":"Ameba/Presenter/BasePresenter.html","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter","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/presenter/base_presenter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter"},{"html_id":"ameba/Ameba/Presenter/RulePresenter","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter"}],"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L9"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":"TODO: allow other IOs","summary":"

TODO allow other IOs

","abstract":false,"location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L7"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","path":"Ameba/Presenter/RuleCollectionPresenter.html","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_collection_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_collection_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rules)-instance-method","name":"run","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":""}],"args_string":"(rules)","args_html":"(rules)","location":{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_collection_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rules","external_name":"rules","restriction":""}],"visibility":"Public","body":"rules = rules.to_h do |rule|\n name = rule.name.split('/')\n name = \"%s/%s\" % {(name[0...-1].join('/')).colorize(:light_gray), name.last.colorize(:white)}\n {name, rule}\nend\nlongest_name = rules.max_of() do |__arg0|\n __arg0.first.size\nend\nrules.group_by() do |__arg1|\n __arg1.last.group\nend.each do |group, group_rules|\n output.puts(\"— %s\" % (group.colorize(:light_blue)).underline)\n output.puts\n group_rules.each do |name, rule|\n output.puts(\" %s [%s] %s %s\" % {rule.enabled? ? ENABLED_MARK : DISABLED_MARK, rule.severity.symbol.to_s.colorize(:green), name.ljust(longest_name), rule.description.colorize(:dark_gray)})\n end\n output.puts\nend\noutput.puts(\"Total rules: %s / %s enabled\" % {rules.size.to_s.colorize(:light_blue), rules.count() do |__arg2|\n __arg2.last.enabled?\nend.to_s.colorize(:light_blue)})\n"}}]},{"html_id":"ameba/Ameba/Presenter/RulePresenter","path":"Ameba/Presenter/RulePresenter.html","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rule)-instance-method","name":"run","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(rule)","args_html":"(rule)","location":{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rule","external_name":"rule","restriction":""}],"visibility":"Public","body":"output.puts\noutput_title(\"Rule info\")\noutput_paragraph(\"%s of a %s severity [enabled: %s]\" % {rule.name.colorize(:magenta), rule.severity.to_s.colorize(rule.severity.color), rule.enabled? ? ENABLED_MARK : DISABLED_MARK})\nif rule_description = colorize_code_fences(rule.description)\n output_paragraph(rule_description)\nend\nif rule_doc = colorize_code_fences(rule.class.parsed_doc)\n output_title(\"Detailed description\")\n output_paragraph(rule_doc)\nend\n"}}]}]},{"html_id":"ameba/Ameba/Reportable","path":"Ameba/Reportable.html","kind":"module","full_name":"Ameba::Reportable","name":"Reportable","abstract":false,"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"locations":[{"filename":"src/ameba/reportable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","instance_methods":[{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L12"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(code, rule, location, end_location, message, status, block)).tap do |issue|\n issues << issue\nend\n"}},{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L27"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L53"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L63"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L76"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"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, block)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=nil,*,prefer_name_location=false):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L37"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":5,"return_type":"Issue","visibility":"Public","body":"if prefer_name_location\n location = name_location(node)\nend\nlocation || (location = node.location)\nif prefer_name_location\n end_location = name_end_location(node)\nend\nend_location || (end_location = node.end_location)\nadd_issue(rule, location, end_location, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L71"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L58"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","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 = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L91"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,*,prefer_name_location=false,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L48"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":4,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node, message, status, block, prefer_name_location: prefer_name_location)"}},{"html_id":"issues-instance-method","name":"issues","doc":"List of reported issues.","summary":"

List of reported issues.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L9"},"def":{"name":"issues","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.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":101,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L101"},"def":{"name":"valid?","visibility":"Public","body":"issues.none?(&.enabled?)"}}]},{"html_id":"ameba/Ameba/Rule","path":"Ameba/Rule.html","kind":"module","full_name":"Ameba::Rule","name":"Rule","abstract":false,"locations":[{"filename":"src/ameba/rule/base.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECIAL","name":"SPECIAL","value":"{Lint::Syntax.rule_name, Lint::UnneededDisableDirective.rule_name}","doc":"List of names of the special rules, which\nbehave differently than usual rules.","summary":"

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

"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L174"},"def":{"name":"rules","visibility":"Public","body":"Base.inherited_rules"}}],"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/6d03cef/src/ameba/rule/base.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"GROUP_SEVERITY","name":"GROUP_SEVERITY","value":"{Documentation: Ameba::Severity::Warning, Lint: Ameba::Severity::Warning, Metrics: Ameba::Severity::Warning, Performance: Ameba::Severity::Warning}"}],"included_modules":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation"},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition"},{"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/DebugCalls","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls"},{"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/Formatting","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument"},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"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/SpecFilename","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename"},{"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/Typos","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos"},{"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/UnusedBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument"},{"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/Naming/AccessorMethodName","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName"},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers"},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Naming/Filename","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename"},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","kind":"class","full_name":"Ameba::Rule::Naming::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","kind":"class","full_name":"Ameba::Rule::Naming::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName"},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","kind":"class","full_name":"Ameba::Rule::Naming::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition"},{"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/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"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"}],"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":"default_severity:Ameba::Severity-class-method","name":"default_severity","abstract":false,"def":{"name":"default_severity","return_type":"Ameba::Severity","visibility":"Public","body":"if (value = @@default_severity).nil?\n @@default_severity = (GROUP_SEVERITY[group_name]? || Ameba::Severity::Convention)\nelse\n value\nend"}}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/rule/base.cr","line_number":108,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L108"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"name == other.try(&.name)"}},{"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L53"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.tap do\n test(source)\nend"}},{"html_id":"excluded?(source)-instance-method","name":"excluded?","doc":"Checks whether the source is excluded from this rule.\nIt searches for a path in `excluded` property which matches\nthe one of the given source.\n\n```\nmy_rule.excluded?(source) # => true or false\n```","summary":"

Checks whether the source is excluded from this rule.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/base.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L91"},"def":{"name":"excluded?","args":[{"name":"source","external_name":"source","restriction":""}],"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L80"},"def":{"name":"group","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.

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L112"},"def":{"name":"hash","visibility":"Public","body":"name.hash"}},{"html_id":"name-instance-method","name":"name","doc":"Returns a name of this rule, which is basically a class name.\n\n```\nclass MyRule < Ameba::Rule::Base\n def test(source)\n end\nend\n\nMyRule.new.name # => \"MyRule\"\n```","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L67"},"def":{"name":"name","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,"location":{"filename":"src/ameba/rule/base.cr","line_number":104,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L104"},"def":{"name":"special?","visibility":"Public","body":"name.in?(SPECIAL)"}},{"html_id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","name":"test","doc":"NOTE: Can't be abstract","summary":"

NOTE Can't be abstract

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","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":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","external_name":"opts","restriction":""}],"splat_index":2,"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source)"}}],"macros":[{"html_id":"issue_for(*args,**kwargs,&block)-macro","name":"issue_for","doc":"Adds an issue to the *source*","summary":"

Adds an issue to the source

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **kwargs, &block)","args_html":"(*args, **kwargs, &block)","location":{"filename":"src/ameba/rule/base.cr","line_number":117,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L117"},"def":{"name":"issue_for","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"kwargs","external_name":"kwargs","restriction":""},"splat_index":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" source.add_issue(self, \n{{ args.splat }}\n, \n{{ kwargs.double_splat }}\n) \n{{ block }}\n\n \n"}}]},{"html_id":"ameba/Ameba/Rule/Documentation","path":"Ameba/Rule/Documentation.html","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation","abstract":false,"locations":[{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L1"},{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","path":"Ameba/Rule/Documentation/Documentation.html","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation","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/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L17"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MACRO_HOOK_NAMES","name":"MACRO_HOOK_NAMES","value":"[\"inherited\", \"included\", \"extended\", \"method_missing\", \"method_added\", \"finished\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Missing documentation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L17"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_classes=(ignore_classes:Bool)-instance-method","name":"ignore_classes=","abstract":false,"args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"args_string":"(ignore_classes : Bool)","args_html":"(ignore_classes : Bool)","def":{"name":"ignore_classes=","args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"visibility":"Public","body":"@ignore_classes = ignore_classes"}},{"html_id":"ignore_classes?:Bool-instance-method","name":"ignore_classes?","abstract":false,"def":{"name":"ignore_classes?","return_type":"Bool","visibility":"Public","body":"@ignore_classes"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_enums=(ignore_enums:Bool)-instance-method","name":"ignore_enums=","abstract":false,"args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"args_string":"(ignore_enums : Bool)","args_html":"(ignore_enums : Bool)","def":{"name":"ignore_enums=","args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"visibility":"Public","body":"@ignore_enums = ignore_enums"}},{"html_id":"ignore_enums?:Bool-instance-method","name":"ignore_enums?","abstract":false,"def":{"name":"ignore_enums?","return_type":"Bool","visibility":"Public","body":"@ignore_enums"}},{"html_id":"ignore_macro_hooks=(ignore_macro_hooks:Bool)-instance-method","name":"ignore_macro_hooks=","abstract":false,"args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"args_string":"(ignore_macro_hooks : Bool)","args_html":"(ignore_macro_hooks : Bool)","def":{"name":"ignore_macro_hooks=","args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macro_hooks = ignore_macro_hooks"}},{"html_id":"ignore_macro_hooks?:Bool-instance-method","name":"ignore_macro_hooks?","abstract":false,"def":{"name":"ignore_macro_hooks?","return_type":"Bool","visibility":"Public","body":"@ignore_macro_hooks"}},{"html_id":"ignore_macros=(ignore_macros:Bool)-instance-method","name":"ignore_macros=","abstract":false,"args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"args_string":"(ignore_macros : Bool)","args_html":"(ignore_macros : Bool)","def":{"name":"ignore_macros=","args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macros = ignore_macros"}},{"html_id":"ignore_macros?:Bool-instance-method","name":"ignore_macros?","abstract":false,"def":{"name":"ignore_macros?","return_type":"Bool","visibility":"Public","body":"@ignore_macros"}},{"html_id":"ignore_modules=(ignore_modules:Bool)-instance-method","name":"ignore_modules=","abstract":false,"args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"args_string":"(ignore_modules : Bool)","args_html":"(ignore_modules : Bool)","def":{"name":"ignore_modules=","args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"visibility":"Public","body":"@ignore_modules = ignore_modules"}},{"html_id":"ignore_modules?:Bool-instance-method","name":"ignore_modules?","abstract":false,"def":{"name":"ignore_modules?","return_type":"Bool","visibility":"Public","body":"@ignore_modules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ClassDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ClassDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_classes? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::ModuleDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_modules? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::EnumDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::EnumDef, scope : AST::Scope)","args_html":"(source, node : Crystal::EnumDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_enums? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/documentation/documentation.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_defs? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Macro,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Macro, scope : AST::Scope)","args_html":"(source, node : Crystal::Macro, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if ignore_macro_hooks? && (node.name.in?(MACRO_HOOK_NAMES))\n return\nend\nignore_macros? || (check_missing_doc(source, node, scope))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","path":"Ameba/Rule/Documentation/DocumentationAdmonition.html","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition","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/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Found a %s admonition in a comment\""},{"id":"MSG_ERR","name":"MSG_ERR","value":"\"%s admonition error: %s\""},{"id":"MSG_LATE","name":"MSG_LATE","value":"\"Found a %s admonition in a comment (%s)\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"admonitions:Array(String)-instance-method","name":"admonitions","abstract":false,"def":{"name":"admonitions","visibility":"Public","body":"@admonitions"}},{"html_id":"admonitions=(admonitions:Array(String))-instance-method","name":"admonitions=","abstract":false,"args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"args_string":"(admonitions : Array(String))","args_html":"(admonitions : Array(String))","def":{"name":"admonitions=","args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"visibility":"Public","body":"@admonitions = admonitions"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type.comment?\n else\n next\n end\n if doc = token.value.to_s\n else\n next\n end\n pattern = /^#\\s*(?#{Regex.union(admonitions)})(?:\\((?.+?)\\))?(?:\\W+|$)/m\n matches = doc.scan(pattern)\n matches.each do |match|\n admonition = match[\"admonition\"]\n begin\n case expr = match[\"context\"]?.presence\n when /\\A\\d{4}-\\d{2}-\\d{2}\\Z/\n date = Time.parse(expr.not_nil!, \"%F\", location)\n issue_for_date(source, token, admonition, date)\n when /\\A\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}(:\\d{2})?\\Z/\n date = Time.parse(expr.not_nil!, \"%F #{$~[1]?.presence ? \"%T\" : \"%R\"}\", location)\n issue_for_date(source, token, admonition, date)\n else\n issue_for(token, MSG % admonition)\n end\n rescue ex\n issue_for(token, MSG_ERR % {admonition, \"#{ex}: #{expr.inspect}\"})\n end\n end\nend"}},{"html_id":"timezone:String-instance-method","name":"timezone","abstract":false,"def":{"name":"timezone","return_type":"String","visibility":"Public","body":"@timezone"}},{"html_id":"timezone=(timezone:String)-instance-method","name":"timezone=","abstract":false,"args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"args_string":"(timezone : String)","args_html":"(timezone : String)","def":{"name":"timezone=","args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"visibility":"Public","body":"@timezone = timezone"}}]}]},{"html_id":"ameba/Ameba/Rule/Layout","path":"Ameba/Rule/Layout.html","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout","abstract":false,"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/6d03cef/src/ameba/rule/layout/line_length.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Line too long\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/layout/line_length.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Int32-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"Int32","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Int32)-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"args_string":"(max_length : Int32)","args_html":"(max_length : Int32)","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/layout/line_length.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line.size > max_length\n issue_for({index + 1, max_length + 1}, MSG)\n end\nend"}}]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","path":"Ameba/Rule/Layout/TrailingBlankLines.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines","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_blank_lines.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/layout/trailing_blank_lines.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Excessive trailing newline detected\""},{"id":"MSG_FINAL_NEWLINE","name":"MSG_FINAL_NEWLINE","value":"\"Trailing newline missing\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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.zero? || ((source_lines.last(2)).join.presence && last_line_empty)\n return\nend\nif last_line_empty\n issue_for({source_lines_size, 1}, MSG)\nelse\n issue_for({source_lines_size, 1}, MSG_FINAL_NEWLINE) do |corrector|\n corrector.insert_before({source_lines_size + 1, 1}, '\\n')\n end\nend\n"}}]},{"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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Trailing whitespace detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if ws_index = line =~ (/\\s+$/)\n else\n next\n end\n location = {index + 1, ws_index + 1}\n end_location = {index + 1, line.size}\n issue_for(location, end_location, MSG) do |corrector|\n corrector.remove(location, end_location)\n end\nend"}}]}]},{"html_id":"ameba/Ameba/Rule/Lint","path":"Ameba/Rule/Lint.html","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint","abstract":false,"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/formatting.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L3"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L1"},{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L3"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/typos.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/ambiguous_assignment.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\": \"-=\", \"=+\": \"+=\", \"=!\": \"!=\"}"},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\""}],"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"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"

This rule checks for mistyped shorthand assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/ambiguous_assignment.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/ambiguous_assignment.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"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 suggestion = MISTAKES[op_text]?\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % suggestion)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/bad_directive.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALL_GROUP_NAMES","name":"ALL_GROUP_NAMES","value":"Rule.rules.map(&.group_name).uniq!"},{"id":"ALL_RULE_NAMES","name":"ALL_RULE_NAMES","value":"Rule.rules.map(&.rule_name)"},{"id":"AVAILABLE_ACTIONS","name":"AVAILABLE_ACTIONS","value":"InlineComments::Action.names.map(&.downcase)"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/bad_directive.cr#L20"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/bad_directive.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison to a boolean is pointless\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif node.args.size == 1\nelse\n return\nend\narg, obj = node.args.first, node.obj\ncase\nwhen arg.is_a?(Crystal::BoolLiteral)\n bool, exp = arg, obj\nwhen obj.is_a?(Crystal::BoolLiteral)\n bool, exp = obj, arg\nend\nif bool && exp\nelse\n return\nend\nif exp_code = node_source(exp, source.lines)\nelse\n return\nend\nnot = case node.name\nwhen \"==\", \"===\"\n !bool.value\nwhen \"!=\"\n bool.value\nend\nif not\n exp_code = \"!#{exp_code}\"\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/DebugCalls","path":"Ameba/Rule/Lint/DebugCalls.html","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls","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/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possibly forgotten debug-related `%s` call detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows calls to debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"method_names:Array(String)-instance-method","name":"method_names","abstract":false,"def":{"name":"method_names","visibility":"Public","body":"@method_names"}},{"html_id":"method_names=(method_names:Array(String))-instance-method","name":"method_names=","abstract":false,"args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"args_string":"(method_names : Array(String))","args_html":"(method_names : Array(String))","def":{"name":"method_names=","args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@method_names = method_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(method_names)) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG % node.name)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/debugger_statement.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possible forgotten debugger statement detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/debugger_statement.cr#L13"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/debugger_statement.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name == \"debugger\") && node.args.empty?) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require of `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/duplicated_require.cr#L16"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/duplicated_require.cr#L23"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if node.string.in?(processed_require_strings)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}]},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_ensure.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty `ensure` block detected\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_ensure.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_ensure.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node_ensure = node.ensure\nif node_ensure.nil? || (!node_ensure.nop?)\n return\nend\nissue_for(node.ensure_location, node.end_location, MSG)\n"}}]},{"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/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/6d03cef/src/ameba/rule/lint/empty_expression.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid empty expressions\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/empty_expression.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Expressions)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_expression.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if (node.expressions.size == 1) && node.expressions.first.nop?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty loop detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if loop?(node)\n check_node(source, node, node.block)\nend"}},{"html_id":"test(source,node:Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_loop.cr#L53"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Formatting","path":"Ameba/Rule/Lint/Formatting.html","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting","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/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use built-in formatter to format this source\""},{"id":"MSG_ERROR","name":"MSG_ERROR","value":"\"Error while formatting: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"begin\n source_code = source.code\n result = Crystal.format(source_code, source.path)\n if result == source_code\n return\n end\n source_lines = source_code.lines\n if source_lines.empty?\n return\n end\n end_location = {source_lines.size, source_lines.last.size + 1}\n issue_for(LOCATION, MSG) do |corrector|\n corrector.replace(LOCATION, end_location, result)\n end\nrescue ex : Crystal::SyntaxException\n if fail_on_error?\n issue_for({ex.line_number, ex.column_number}, MSG_ERROR % ex.message)\n end\nrescue ex\n if fail_on_error?\n issue_for(LOCATION, MSG_ERROR % ex.message)\n end\nend"}}]},{"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/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated keys in hash literal: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::HashLiteral)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if (keys = duplicated_keys(node.entries)).empty?\n return\nend\nissue_for(node, MSG % (keys.join(\", \")))\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","path":"Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions","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_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Detected assignment with a literal value in control expression\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if (cond = node.cond).is_a?(Crystal::Assign)\nelse\n return\nend\nif literal?(cond.value)\nelse\n return\nend\nissue_for(cond, MSG)\n"}}]},{"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":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_in_condition.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in conditional\""}],"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"}],"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\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_in_condition.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_in_condition.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"visibility":"Public","body":"if static_literal?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in interpolation\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"node.expressions.select do |exp|\n (!exp.is_a?(Crystal::StringLiteral)) && (literal?(exp))\nend.each do |exp|\n issue_for(exp, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralsComparison","path":"Ameba/Rule/Lint/LiteralsComparison.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison","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/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L19"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison always evaluates to %s\""},{"id":"MSG_LIKELY","name":"MSG_LIKELY","value":"\"Comparison most likely evaluates to %s\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"===\", \"==\", \"!=\"] of ::String"}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L19"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif (obj = node.obj) && (arg = node.args.first?)\nelse\n return\nend\nobj_is_literal, obj_is_static = literal_kind?(obj)\narg_is_literal, arg_is_static = literal_kind?(arg)\nif obj_is_literal && arg_is_literal\nelse\n return\nend\nif obj.to_s == arg.to_s\nelse\n return\nend\nis_dynamic = (!obj_is_static) || (!arg_is_static)\nwhat = case node.name\nwhen \"===\"\n \"the same\"\nwhen \"==\"\n \"true\"\nwhen \"!=\"\n \"false\"\nend\nissue_for(node, (is_dynamic ? MSG_LIKELY : MSG) % what)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","path":"Ameba/Rule/Lint/MissingBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument","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/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Missing anonymous block argument. Use `&` as an argument name to indicate yielding method.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/missing_block_argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if (!scope.yields?) || node.block_arg\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L30"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","path":"Ameba/Rule/Lint/NotNil.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil","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/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid using `not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"not_nil!\"\nelse\n return\nend\nif node.obj && node.args.empty?\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","path":"Ameba/Rule/Lint/NotNilAfterNoBang.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang","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/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BLOCK_CALL_NAMES","name":"BLOCK_CALL_NAMES","value":"[\"index\", \"rindex\", \"find\"] of ::String"},{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"index\", \"rindex\", \"match\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s! {...}` instead of `%s {...}.not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usage of `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"not_nil!\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.name.in?(obj.block ? BLOCK_CALL_NAMES : CALL_NAMES)\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif name_location_end = name_end_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {obj.name, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.insert_after(name_location_end, '!')\n corrector.remove_trailing(node, {{ \".not_nil!\".size }})\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/6d03cef/src/ameba/rule/lint/percent_array.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Symbols `%s` may be unwanted in %s array literals\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/percent_array.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"string_array_unwanted_symbols:String-instance-method","name":"string_array_unwanted_symbols","abstract":false,"def":{"name":"string_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"args_string":"(string_array_unwanted_symbols : String)","args_html":"(string_array_unwanted_symbols : String)","def":{"name":"string_array_unwanted_symbols=","args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"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","abstract":false,"def":{"name":"symbol_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"args_string":"(symbol_array_unwanted_symbols : String)","args_html":"(symbol_array_unwanted_symbols : String)","def":{"name":"symbol_array_unwanted_symbols=","args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"visibility":"Public","body":"@symbol_array_unwanted_symbols = symbol_array_unwanted_symbols"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/percent_array.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 = start_token) && (!issue)\n issue = array_entry_invalid?(token.value.to_s, _start.raw)\n end\n when .string_array_end?\n if (_start = start_token) && (_issue = issue)\n issue_for(_start, _issue)\n end\n issue = start_token = nil\n end\nend\n"}}]},{"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/6d03cef/src/ameba/rule/lint/rand_zero.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"%s always returns 0\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```","summary":"

A rule that disallows rand(0) and rand(1) calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/rand_zero.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/rand_zero.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name == \"rand\") && (node.args.size == 1)) && (arg = node.args.first).is_a?(Crystal::NumberLiteral)) && (arg.value.in?(\"0\", \"1\"))\nelse\n return\nend\nissue_for(node, MSG % node)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","path":"Ameba/Rule/Lint/RedundantStringCoercion.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion","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/redundant_string_coercion.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_string_coercion.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant use of `Object#to_s` in interpolation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"(string_coercion_nodes(node)).each do |expr|\n issue_for(name_location(expr), expr.end_location, MSG)\nend"}}]},{"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":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_index.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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\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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n\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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_index.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_index.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"args, block = node.args, node.block\nif block.nil? || args.size > 1\n return\nend\nif with_index_arg?(block)\n return\nend\ncase node.name\nwhen \"with_index\"\n report(source, node, \"Remove redundant with_index\")\nwhen \"each_with_index\"\n report(source, node, \"Use each instead of each_with_index\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","path":"Ameba/Rule/Lint/RedundantWithObject.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject","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_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_object.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `each` instead of `each_with_object`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_object.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_object.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name != \"each_with_object\") || (node.args.size != 1)) || (!(block = node.block))) || (with_index_arg?(block))\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","path":"Ameba/Rule/Lint/ShadowedArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument","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_argument.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Argument `%s` is assigned before it is used\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```","summary":"

A rule that disallows shadowed arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowed exception found: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L36"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"rescues = node.rescues\nif rescues.nil?\n return\nend\n(shadowed(rescues)).each do |path|\n issue_for(path, MSG % (path.names.join(\"::\")))\nend\n"}}]},{"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_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowing outer local variable `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral|Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"find_shadowing(source, scope)"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroFor])"}}]},{"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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shared variable `%s` is used in fiber\""}],"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"}],"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 techniques 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 techniques 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","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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/SpecFilename","path":"Ameba/Rule/Lint/SpecFilename.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename","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_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L14"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Spec filename should have `_spec` suffix: %s.cr, not %s.cr\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L14"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignored_dirs:Array(String)-instance-method","name":"ignored_dirs","abstract":false,"def":{"name":"ignored_dirs","visibility":"Public","body":"@ignored_dirs"}},{"html_id":"ignored_dirs=(ignored_dirs:Array(String))-instance-method","name":"ignored_dirs=","abstract":false,"args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"args_string":"(ignored_dirs : Array(String))","args_html":"(ignored_dirs : Array(String))","def":{"name":"ignored_dirs=","args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_dirs = ignored_dirs"}},{"html_id":"ignored_filenames:Array(String)-instance-method","name":"ignored_filenames","abstract":false,"def":{"name":"ignored_filenames","visibility":"Public","body":"@ignored_filenames"}},{"html_id":"ignored_filenames=(ignored_filenames:Array(String))-instance-method","name":"ignored_filenames=","abstract":false,"args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"args_string":"(ignored_filenames : Array(String))","args_html":"(ignored_filenames : Array(String))","def":{"name":"ignored_filenames=","args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_filenames = ignored_filenames"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source:Source)-instance-method","name":"test","doc":"TODO: fix the assumption that *source.path* contains relative path","summary":"

TODO fix the assumption that source.path contains relative path

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path_ = Path[source.path].to_posix\nname = path_.stem\npath = path_.to_s\nif path.starts_with?(\"spec/\")\nelse\n return\nend\nif path.ends_with?(\".cr\")\nelse\n return\nend\nif name.ends_with?(\"_spec\")\n return\nend\nignored_dirs.each do |substr|\n if path.starts_with?(\"#{substr}/\")\n return\n end\nend\nif name.in?(ignored_filenames)\n return\nend\nexpected = \"#{name}_spec\"\nissue_for(LOCATION, MSG % {expected, name}) do\n new_path = path_.sibling(expected + path_.extension)\n FileUtils.mv(path, new_path)\nend\n"}}]},{"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/6d03cef/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\""},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/spec_focus.cr#L47"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":62,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_focus.cr#L62"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nelse\n return\nend\nissue_for(arg, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":56,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_focus.cr#L56"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/syntax.cr#L21"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/syntax.cr#L21"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","return_type":"Ameba::Severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/syntax.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Typos","path":"Ameba/Rule/Lint/Typos.html","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos","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/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BIN_PATH","name":"BIN_PATH","value":"Process.find_executable(\"typos\")"},{"id":"MSG","name":"MSG","value":"\"Typo found: %s -> %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L15"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"bin_path:String|Nil-instance-method","name":"bin_path","abstract":false,"location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L27"},"def":{"name":"bin_path","return_type":"String | ::Nil","visibility":"Public","body":"@bin_path || BIN_PATH"}},{"html_id":"bin_path=(bin_path:Union(String,Nil))-instance-method","name":"bin_path=","abstract":false,"args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"args_string":"(bin_path : Union(String, Nil))","args_html":"(bin_path : Union(String, Nil))","def":{"name":"bin_path=","args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"visibility":"Public","body":"@bin_path = bin_path"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"begin\n typos = typos_from(source)\n typos.try(&.each do |typo|\n corrections = typo.corrections\n message = MSG % {typo.typo, corrections.join(\" | \")}\n if corrections.size == 1\n issue_for(typo.location, typo.end_location, message) do |corrector|\n corrector.replace(typo.location, typo.end_location, corrections.first)\n end\n else\n issue_for(typo.location, typo.end_location, message)\n end\n end)\nrescue ex\n if fail_on_error?\n raise(ex)\n end\nend"}}]},{"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/6d03cef/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unnecessary disabling of %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L44"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unreachable code detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L44"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","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":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"visibility":"Public","body":"if unreachable_node = flow_expression.unreachable_nodes.first?\nelse\n return\nend\nissue_for(unreachable_node, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::FlowExpressionVisitor.new(self, source)"}}]},{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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.\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","name":"ignore_blocks=","abstract":false,"args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"args_string":"(ignore_blocks : Bool)","args_html":"(ignore_blocks : Bool)","def":{"name":"ignore_blocks=","args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_blocks = ignore_blocks"}},{"html_id":"ignore_blocks?:Bool-instance-method","name":"ignore_blocks?","abstract":false,"def":{"name":"ignore_blocks?","return_type":"Bool","visibility":"Public","body":"@ignore_blocks"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_procs=(ignore_procs:Bool)-instance-method","name":"ignore_procs=","abstract":false,"args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"args_string":"(ignore_procs : Bool)","args_html":"(ignore_procs : Bool)","def":{"name":"ignore_procs=","args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_procs = ignore_procs"}},{"html_id":"ignore_procs?:Bool-instance-method","name":"ignore_procs?","abstract":false,"def":{"name":"ignore_procs?","return_type":"Bool","visibility":"Public","body":"@ignore_procs"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L44"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_procs? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_blocks? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Def, scope : AST::Scope)","args_html":"(source, node : Crystal::Def, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"arguments = scope.arguments.dup\nif block_arg = node.block_arg\n arguments.reject!() do |__arg0|\n __arg0.node == block_arg\n end\nend\nignore_defs? || (find_unused_arguments(source, scope, arguments))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/UnusedBlockArgument","path":"Ameba/Rule/Lint/UnusedBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument","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_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_UNUSED","name":"MSG_UNUSED","value":"\"Unused block argument `%1$s`. If it's necessary, use `_%1$s` as an argument name to indicate that it won't be used.\""},{"id":"MSG_YIELDED","name":"MSG_YIELDED","value":"\"Use `&` as an argument name to indicate that it won't be referenced.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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_block_argument.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if node.abstract?\n return\nend\nif block_arg = node.block_arg\nelse\n return\nend\nif block_arg = scope.arguments.find() do |__arg0|\n __arg0.node == block_arg\nend\nelse\n return\nend\nif block_arg.anonymous?\n return\nend\nif scope.references?(block_arg.variable)\n return\nend\nlocation = block_arg.node.location\nend_location = location.try(&.adjust(column_number: block_arg.name.size - 1))\ncase\nwhen scope.yields?\n if location && end_location\n issue_for(location, end_location, MSG_YIELDED) do |corrector|\n corrector.remove(location, end_location)\n end\n else\n issue_for(block_arg.node, MSG_YIELDED)\n end\nwhen !block_arg.ignored?\n if location && end_location\n issue_for(location, end_location, MSG_UNUSED % block_arg.name) do |corrector|\n corrector.insert_before(location, '_')\n end\n else\n issue_for(block_arg.node, MSG_UNUSED % block_arg.name)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless assignment to variable `%s`\""}],"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"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_type_declarations=(exclude_type_declarations:Bool)-instance-method","name":"exclude_type_declarations=","abstract":false,"args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"args_string":"(exclude_type_declarations : Bool)","args_html":"(exclude_type_declarations : Bool)","def":{"name":"exclude_type_declarations=","args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"visibility":"Public","body":"@exclude_type_declarations = exclude_type_declarations"}},{"html_id":"exclude_type_declarations?:Bool-instance-method","name":"exclude_type_declarations?","abstract":false,"def":{"name":"exclude_type_declarations?","return_type":"Bool","visibility":"Public","body":"@exclude_type_declarations"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if scope.lib_def?(check_outer_scopes: true)\n return\nend\nscope.variables.each do |var|\n if (var.ignored? || var.used_in_macro?) || var.captured_by_block?\n next\n end\n if exclude_type_declarations? && (scope.assigns_type_dec?(var.name))\n next\n end\n var.assignments.each do |assign|\n check_assignment(source, assign, var)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless condition in when detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::When)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"ConditionInWhenVisitor.new(self, source, node)"}}]}]},{"html_id":"ameba/Ameba/Rule/Metrics","path":"Ameba/Rule/Metrics.html","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics","abstract":false,"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Cyclomatic complexity too high [%d/%d]\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_complexity:Int32-instance-method","name":"max_complexity","abstract":false,"def":{"name":"max_complexity","return_type":"Int32","visibility":"Public","body":"@max_complexity"}},{"html_id":"max_complexity=(max_complexity:Int32)-instance-method","name":"max_complexity=","abstract":false,"args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"args_string":"(max_complexity : Int32)","args_html":"(max_complexity : Int32)","def":{"name":"max_complexity=","args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"visibility":"Public","body":"@max_complexity = max_complexity"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"complexity = (AST::CountingVisitor.new(node)).count\nif complexity > max_complexity\nelse\n return\nend\nissue_for(node, MSG % {complexity, max_complexity}, prefer_name_location: true)\n"}}]}]},{"html_id":"ameba/Ameba/Rule/Naming","path":"Ameba/Rule/Naming.html","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming","abstract":false,"locations":[{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L1"},{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L1"},{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L1"},{"filename":"src/ameba/rule/naming/filename.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L1"},{"filename":"src/ameba/rule/naming/method_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L1"},{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L1"},{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L1"},{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L1"},{"filename":"src/ameba/rule/naming/type_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L1"},{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Naming/AccessorMethodName","path":"Ameba/Rule/Naming/AccessorMethodName.html","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName","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/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"defs = case body = node.body\nwhen Crystal::Def\n [body]\nwhen Crystal::Expressions\n body.expressions.select(Crystal::Def)\nend\ndefs.try(&.each do |def_node|\n if def_node.receiver\n else\n check_issue(source, def_node)\n end\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.receiver\n check_issue(source, node)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","path":"Ameba/Rule/Naming/AsciiIdentifiers.html","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers","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/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Identifier contains non-ascii characters\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_symbols=(ignore_symbols:Bool)-instance-method","name":"ignore_symbols=","abstract":false,"args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"args_string":"(ignore_symbols : Bool)","args_html":"(ignore_symbols : Bool)","def":{"name":"ignore_symbols=","args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"visibility":"Public","body":"@ignore_symbols = ignore_symbols"}},{"html_id":"ignore_symbols?:Bool-instance-method","name":"ignore_symbols?","abstract":false,"def":{"name":"ignore_symbols?","return_type":"Bool","visibility":"Public","body":"@ignore_symbols"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\n check_issue(source, target, target)\nend\ncheck_symbol_literal(source, node.value)\n"}},{"html_id":"test(source,node:Crystal::MultiAssign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(source, node : Crystal::MultiAssign)","args_html":"(source, node : Crystal::MultiAssign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"node.values.each do |value|\n check_symbol_literal(source, value)\nend"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L46"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.args.each do |arg|\n check_symbol_literal(source, arg)\nend\nnode.named_args.try(&.each do |arg|\n check_symbol_literal(source, arg.value)\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)\nnode.args.each do |arg|\n check_issue(source, arg, prefer_name_location: true)\n check_symbol_literal(source, arg.default_value)\nend\n"}},{"html_id":"test(source,node:Crystal::ClassVar|Crystal::InstanceVar|Crystal::Var|Crystal::Alias)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"args_string":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","args_html":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L64"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef|Crystal::EnumDef|Crystal::LibDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L68"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"visibility":"Public","body":"check_issue(source, node.name, node.name)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","path":"Ameba/Rule/Naming/BinaryOperatorParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName","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/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"When defining the `%s` operator, name its argument `other`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"excluded_operators:Array(String)-instance-method","name":"excluded_operators","abstract":false,"def":{"name":"excluded_operators","visibility":"Public","body":"@excluded_operators"}},{"html_id":"excluded_operators=(excluded_operators:Array(String))-instance-method","name":"excluded_operators=","abstract":false,"args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"args_string":"(excluded_operators : Array(String))","args_html":"(excluded_operators : Array(String))","def":{"name":"excluded_operators=","args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"visibility":"Public","body":"@excluded_operators = excluded_operators"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name\nif (name == \"->\") || (name.in?(excluded_operators))\n return\nend\nif name.chars.any?(&.alphanumeric?)\n return\nend\nif node.args.size == 1\nelse\n return\nend\nif (arg = node.args.first).name == \"other\"\n return\nend\nissue_for(arg, MSG % name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","path":"Ameba/Rule/Naming/BlockParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName","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/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed block parameter name found\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_names_ending_in_numbers=(allow_names_ending_in_numbers:Bool)-instance-method","name":"allow_names_ending_in_numbers=","abstract":false,"args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"args_string":"(allow_names_ending_in_numbers : Bool)","args_html":"(allow_names_ending_in_numbers : Bool)","def":{"name":"allow_names_ending_in_numbers=","args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"visibility":"Public","body":"@allow_names_ending_in_numbers = allow_names_ending_in_numbers"}},{"html_id":"allow_names_ending_in_numbers?:Bool-instance-method","name":"allow_names_ending_in_numbers?","abstract":false,"def":{"name":"allow_names_ending_in_numbers?","return_type":"Bool","visibility":"Public","body":"@allow_names_ending_in_numbers"}},{"html_id":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"forbidden_names:Array(String)-instance-method","name":"forbidden_names","abstract":false,"def":{"name":"forbidden_names","visibility":"Public","body":"@forbidden_names"}},{"html_id":"forbidden_names=(forbidden_names:Array(String))-instance-method","name":"forbidden_names=","abstract":false,"args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"args_string":"(forbidden_names : Array(String))","args_html":"(forbidden_names : Array(String))","def":{"name":"forbidden_names=","args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@forbidden_names = forbidden_names"}},{"html_id":"min_name_length:Int32-instance-method","name":"min_name_length","abstract":false,"def":{"name":"min_name_length","return_type":"Int32","visibility":"Public","body":"@min_name_length"}},{"html_id":"min_name_length=(min_name_length:Int32)-instance-method","name":"min_name_length=","abstract":false,"args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"args_string":"(min_name_length : Int32)","args_html":"(min_name_length : Int32)","def":{"name":"min_name_length=","args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"visibility":"Public","body":"@min_name_length = min_name_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.try(&.block).try(&.args).try(&.each do |arg|\n if valid_name?(arg.name)\n else\n issue_for(arg, MSG)\n end\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","path":"Ameba/Rule/Naming/ConstantNames.html","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames","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/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Constant name should be screaming-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\nelse\n return\nend\nname = target.to_s\nexpected = name.upcase\nif name.in?(expected, name.camelcase)\n return\nend\nissue_for(target, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/Filename","path":"Ameba/Rule/Naming/Filename.html","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename","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/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Filename should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path = Path[source.path]\nname = path.basename\nif (expected = name.underscore) == name\n return\nend\nissue_for(LOCATION, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","path":"Ameba/Rule/Naming/MethodNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Method name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","path":"Ameba/Rule/Naming/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s?' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.name =~ (/^is_([a-z]\\w*)\\??$/)\nelse\n return\nend\nalternative = $~[1]\nissue_for(node, MSG % {alternative, node.name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","path":"Ameba/Rule/Naming/QueryBoolMethods.html","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods","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/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"getter\", \"class_getter\", \"property\", \"class_property\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Consider using '%s?' for '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"calls = case body = node.body\nwhen Crystal::Call\n if body.name.in?(CALL_NAMES)\n [body]\n end\nwhen Crystal::Expressions\n (body.expressions.select(Crystal::Call)).select!() do |__arg0|\n __arg0.name.in?(CALL_NAMES)\n end\nend\ncalls.try(&.each do |exp|\n exp.args.each do |arg|\n name_node, is_bool = case arg\n when Crystal::Assign\n {arg.target, arg.value.is_a?(Crystal::BoolLiteral)}\n when Crystal::TypeDeclaration\n {arg.var, path_named?(arg.declared_type, \"Bool\")}\n else\n {nil, false}\n end\n if name_node && is_bool\n issue_for(name_node, MSG % {exp.name, name_node})\n end\n end\nend)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","path":"Ameba/Rule/Naming/RescuedExceptionsVariableName.html","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName","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/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed variable name, use one of these instead: '%s'\""},{"id":"MSG_SINGULAR","name":"MSG_SINGULAR","value":"\"Disallowed variable name, use '%s' instead\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node.rescues.try(&.each do |rescue_node|\n if valid_name?(rescue_node.name)\n next\n end\n message = allowed_names.size == 1 ? MSG_SINGULAR : MSG\n issue_for(rescue_node, message % (allowed_names.join(\"', '\")))\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","path":"Ameba/Rule/Naming/TypeNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Type name should be camelcased: %s, but it was %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Alias|Crystal::ClassDef|Crystal::ModuleDef|Crystal::LibDef|Crystal::EnumDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"args_string":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","args_html":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.camelcase) == name\n return\nend\nissue_for(node.name, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","path":"Ameba/Rule/Naming/VariableNames.html","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames","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/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Var name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Var|Crystal::InstanceVar|Crystal::ClassVar)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"args_string":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","args_html":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name})\n"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"VarVisitor.new(self, source)"}}]}]},{"html_id":"ameba/Ameba/Rule/Performance","path":"Ameba/Rule/Performance.html","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance","abstract":false,"locations":[{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L3"},{"filename":"src/ameba/rule/performance/base.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/base.cr#L3"},{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L3"},{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L3"},{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L3"},{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","path":"Ameba/Rule/Performance/AnyAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `any? {...}` instead of `%s {...}.any?`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"any?\") && (obj = node.obj)\nelse\n return\nend\nif (obj.is_a?(Crystal::Call) && obj.block) && node.block.nil?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","path":"Ameba/Rule/Performance/AnyInsteadOfEmpty.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty","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/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `!{...}.empty?` instead of `{...}.any?`\""}],"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"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"any?\"\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif node.obj\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/Base","path":"Ameba/Rule/Performance/Base.html","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base","abstract":true,"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/performance/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/base.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"A general base class for performance rules.","summary":"

A general base class for performance rules.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/performance/base.cr#L5"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/performance/base.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/base.cr#L6"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.spec? ? source : super(source)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","path":"Ameba/Rule/Performance/ChainedCallWithNoBang.html","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALLOCATING_METHOD_NAMES","name":"ALLOCATING_METHOD_NAMES","value":"[\"keys\", \"values\", \"values_at\", \"map\", \"map_with_index\", \"flat_map\", \"compact_map\", \"flatten\", \"compact\", \"select\", \"reject\", \"sample\", \"group_by\", \"chunks\", \"tally\", \"merge\", \"combinations\", \"repeated_combinations\", \"permutations\", \"repeated_permutations\", \"transpose\", \"invert\", \"chars\", \"captures\", \"named_captures\", \"clone\"] of ::String","doc":"All these methods allocate a new object","summary":"

All these methods allocate a new object

"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"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","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nif end_location = name_end_location(node)\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true) do |corrector|\n corrector.insert_after(end_location, '!')\n end\nelse\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/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/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/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","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.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"compact\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","path":"Ameba/Rule/Performance/ExcessiveAllocations.html","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L32"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `%s.each {...}` to avoid excessive allocation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L32"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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:Hash(String,String)-instance-method","name":"call_names","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Hash(String,String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"args_string":"(call_names : Hash(String, String))","args_html":"(call_names : Hash(String, String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"each\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.args.empty? && obj.block.nil?\nelse\n return\nend\nif method = call_names[obj.name]?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {method, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.replace(name_location, end_location, method)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","path":"Ameba/Rule/Performance/FirstLastAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"first\", \"last\", \"first?\", \"last?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `find {...}` instead of `%s {...}.%s`\""},{"id":"MSG_REVERSE","name":"MSG_REVERSE","value":"\"Use `reverse_each.find {...}` instead of `%s {...}.%s`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nmessage = node.name.includes?(CALL_NAMES.first) ? MSG : MSG_REVERSE\nissue_for(name_location(obj), name_end_location(node), message % {obj.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","path":"Ameba/Rule/Performance/FlattenAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `flat_map {...}` instead of `map {...}.flatten`\""}],"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"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"flatten\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","path":"Ameba/Rule/Performance/MapInsteadOfBlock.html","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"sum\", \"product\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`\""}],"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"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % {node.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","path":"Ameba/Rule/Performance/MinMaxAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"min\", \"min?\", \"max\", \"max?\", \"minmax\", \"minmax?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`.\""}],"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"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L42"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name.in?(CALL_NAMES)) && node.block.nil?) && node.args.empty?\nelse\n return\nend\nif (obj = node.obj) && obj.is_a?(Crystal::Call)\nelse\n return\nend\nif ((obj.name == \"map\") && obj.block) && obj.args.empty?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nof_name = node.name.sub(/(.+?)(\\?)?$/, \"\\\\1_of\\\\2\")\nmessage = MSG % {of_name, node.name}\nissue_for(name_location, end_location, message) do |corrector|\n if node_name_location = name_location(node)\n else\n next\n end\n corrector.replace(name_location, name_location.adjust(column_number: {{ \"map\".size - 1 }}), of_name)\n corrector.remove(node_name_location.adjust(column_number: -1), end_location)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","path":"Ameba/Rule/Performance/SizeAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `count {...}` instead of `%s {...}.size`.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":49,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"size\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]}]},{"html_id":"ameba/Ameba/Rule/Style","path":"Ameba/Rule/Style.html","kind":"module","full_name":"Ameba::Rule::Style","name":"Style","abstract":false,"locations":[{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L1"},{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L1"},{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L1"},{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/large_numbers.cr#L1"},{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L1"},{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L1"},{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_begin.cr#L1"},{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L1"},{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L1"},{"filename":"src/ameba/rule/style/unless_else.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/unless_else.cr#L1"},{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/verbose_block.cr#L1"},{"filename":"src/ameba/rule/style/while_true.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/while_true.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Style/GuardClause","path":"Ameba/Rule/Style/GuardClause.html","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause","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/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use a guard clause (`%s`) instead of wrapping the code inside a conditional expression.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"guard_clause_source(source,guard_clause,parent)-instance-method","name":"guard_clause_source","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"args_string":"(source, guard_clause, parent)","args_html":"(source, guard_clause, parent)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L180"},"def":{"name":"guard_clause_source","args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"visibility":"Public","body":"node = parent.is_a?(Crystal::BinaryOp) ? parent : guard_clause\nnode_source(node, source.lines)\n"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L71"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"final_expression = if (body = node.body).is_a?(Crystal::Expressions)\n body.last\nelse\n body\nend\ncase final_expression\nwhen Crystal::If, Crystal::Unless\n check_ending_if(source, final_expression)\nend\n"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"args_string":"(source, node : Crystal::If | Crystal::Unless)","args_html":"(source, node : Crystal::If | Crystal::Unless)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":85,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L85"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"visibility":"Public","body":"if accepted_form?(source, node, ending: false)\n return\nend\ncase\nwhen guard_clause = guard_clause(node.then)\n parent, conditional_keyword = node.then, keyword(node)\nwhen guard_clause = guard_clause(node.else)\n parent, conditional_keyword = node.else, opposite_keyword(node)\nend\nif (guard_clause && parent) && conditional_keyword\nelse\n return\nend\nguard_clause_source = guard_clause_source(source, guard_clause, parent)\nreport_issue(source, node, guard_clause_source, conditional_keyword)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Assign])"}}]},{"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/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/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s` instead of `%s`\""},{"id":"NEW","name":"NEW","value":"\"%s(%s)\""},{"id":"OLD","name":"OLD","value":"\"%s {...}\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L41"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L58"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(filter_names)\nelse\n return\nend\nif filter_location = name_location(node)\nelse\n return\nend\nif block = node.block\nelse\n return\nend\nif (body = block.body).is_a?(Crystal::IsA)\nelse\n return\nend\nif (path = body.const).is_a?(Crystal::Path)\nelse\n return\nend\nif body.obj.is_a?(Crystal::Var)\nelse\n return\nend\nif block.args.size > 1\n return\nend\nname = path.names.join(\"::\")\nif path.global? && (!body.nil_check?)\n name = \"::#{name}\"\nend\nend_location = node.end_location\nif (!end_location) || end_location.try() do |__arg0|\n __arg0.column_number.zero?\nend\n if end_location = path.end_location\n end_location = end_location.adjust(column_number: 1)\n end\nend\nold = OLD % node.name\nnew = NEW % {node.name, name}\nmsg = MSG % {new, old}\nif end_location\n issue_for(filter_location, end_location, msg) do |corrector|\n corrector.replace(filter_location, end_location, new)\n end\nelse\n issue_for(filter_location, nil, msg)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Style/IsANil","path":"Ameba/Rule/Style/IsANil.html","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil","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/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `nil?` instead of `is_a?(Nil)`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::IsA)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(source, node : Crystal::IsA)","args_html":"(source, node : Crystal::IsA)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if node.nil_check?\n return\nend\nconst = node.const\nif path_named?(const, \"Nil\")\nelse\n return\nend\nissue_for(const, MSG) do |corrector|\n corrector.replace(node, \"#{node.obj}.nil?\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","path":"Ameba/Rule/Style/LargeNumbers.html","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers","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/large_numbers.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/large_numbers.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Large numbers should be written with underscores: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/style/large_numbers.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"int_min_digits:Int32-instance-method","name":"int_min_digits","abstract":false,"def":{"name":"int_min_digits","return_type":"Int32","visibility":"Public","body":"@int_min_digits"}},{"html_id":"int_min_digits=(int_min_digits:Int32)-instance-method","name":"int_min_digits=","abstract":false,"args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"args_string":"(int_min_digits : Int32)","args_html":"(int_min_digits : Int32)","def":{"name":"int_min_digits=","args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"visibility":"Public","body":"@int_min_digits = int_min_digits"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/style/large_numbers.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 location = token.location\n end_location = location.adjust(column_number: token.raw.size - 1)\n issue_for(location, end_location, MSG % expected) do |corrector|\n corrector.replace(location, end_location, expected)\n end\n end\nend"}}]},{"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/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid negated conditions in unless blocks\""}],"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"}],"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.empty?\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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.empty?\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","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/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if negated_condition?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","path":"Ameba/Rule/Style/ParenthesesAroundCondition.html","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition","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/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_MISSING","name":"MSG_MISSING","value":"\"Missing parentheses\""},{"id":"MSG_REDUNDANT","name":"MSG_REDUNDANT","value":"\"Redundant parentheses\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_safe_assignment=(allow_safe_assignment:Bool)-instance-method","name":"allow_safe_assignment=","abstract":false,"args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"args_string":"(allow_safe_assignment : Bool)","args_html":"(allow_safe_assignment : Bool)","def":{"name":"allow_safe_assignment=","args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"visibility":"Public","body":"@allow_safe_assignment = allow_safe_assignment"}},{"html_id":"allow_safe_assignment?:Bool-instance-method","name":"allow_safe_assignment?","abstract":false,"def":{"name":"allow_safe_assignment?","return_type":"Bool","visibility":"Public","body":"@allow_safe_assignment"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_ternary=(exclude_ternary:Bool)-instance-method","name":"exclude_ternary=","abstract":false,"args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"args_string":"(exclude_ternary : Bool)","args_html":"(exclude_ternary : Bool)","def":{"name":"exclude_ternary=","args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"visibility":"Public","body":"@exclude_ternary = exclude_ternary"}},{"html_id":"exclude_ternary?:Bool-instance-method","name":"exclude_ternary?","abstract":false,"def":{"name":"exclude_ternary?","return_type":"Bool","visibility":"Public","body":"@exclude_ternary"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"cond = node.cond\nif cond.is_a?(Crystal::Assign) && allow_safe_assignment?\n issue_for(cond, MSG_MISSING) do |corrector|\n corrector.wrap(cond, '(', ')')\n end\n return\nend\nis_ternary = node.is_a?(Crystal::If) && node.ternary?\nif is_ternary && exclude_ternary?\n return\nend\nif cond.is_a?(Crystal::Expressions)\nelse\n return\nend\nif cond.keyword.paren?\nelse\n return\nend\nif exp = cond.single_expression?\nelse\n return\nend\nif strip_parentheses?(exp, is_ternary)\nelse\n return\nend\nissue_for(cond, MSG_REDUNDANT) do |corrector|\n corrector.remove_trailing(cond, 1)\n corrector.remove_leading(cond, 1)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","path":"Ameba/Rule/Style/RedundantBegin.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin","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/style/redundant_begin.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_begin.cr#L58"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `begin` block detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```","summary":"

A rule that disallows redundant begin blocks.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/style/redundant_begin.cr#L58"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/style/redundant_begin.cr#L67"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if def_loc = node.location\nelse\n return\nend\ncase body = node.body\nwhen Crystal::ExceptionHandler\n if (begin_exprs_in_handler?(body)) || (inner_handler?(body))\n return\n end\nwhen Crystal::Expressions\n if redundant_begin_in_expressions?(body)\n else\n return\n end\nelse\n return\nend\nif begin_range = def_redundant_begin_range(source, node)\nelse\n return\nend\nbegin_loc, end_loc = begin_range\nbegin_loc, end_loc = def_loc.seek(begin_loc), def_loc.seek(end_loc)\nbegin_end_loc = begin_loc.adjust(column_number: {{ \"begin\".size - 1 }})\nend_end_loc = end_loc.adjust(column_number: {{ \"end\".size - 1 }})\nissue_for(begin_loc, begin_end_loc, MSG) do |corrector|\n corrector.remove(begin_loc, begin_end_loc)\n corrector.remove(end_loc, end_end_loc)\nend\n"}}]},{"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/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/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L99"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `next` detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/style/redundant_next.cr#L99"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_next:Bool)-instance-method","name":"allow_empty_next=","abstract":false,"args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"args_string":"(allow_empty_next : Bool)","args_html":"(allow_empty_next : Bool)","def":{"name":"allow_empty_next=","args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_next = allow_empty_next"}},{"html_id":"allow_empty_next?:Bool-instance-method","name":"allow_empty_next?","abstract":false,"def":{"name":"allow_empty_next?","return_type":"Bool","visibility":"Public","body":"@allow_empty_next"}},{"html_id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","name":"allow_multi_next=","abstract":false,"args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"args_string":"(allow_multi_next : Bool)","args_html":"(allow_multi_next : Bool)","def":{"name":"allow_multi_next=","args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_next = allow_multi_next"}},{"html_id":"allow_multi_next?:Bool-instance-method","name":"allow_multi_next?","abstract":false,"def":{"name":"allow_multi_next?","return_type":"Bool","visibility":"Public","body":"@allow_multi_next"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","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":115,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L115"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Block)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":111,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L111"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/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/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `return` detected\""}],"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"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/style/redundant_return.cr#L96"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_return:Bool)-instance-method","name":"allow_empty_return=","abstract":false,"args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"args_string":"(allow_empty_return : Bool)","args_html":"(allow_empty_return : Bool)","def":{"name":"allow_empty_return=","args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_return = allow_empty_return"}},{"html_id":"allow_empty_return?:Bool-instance-method","name":"allow_empty_return?","abstract":false,"def":{"name":"allow_empty_return?","return_type":"Bool","visibility":"Public","body":"@allow_empty_return"}},{"html_id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","name":"allow_multi_return=","abstract":false,"args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"args_string":"(allow_multi_return : Bool)","args_html":"(allow_multi_return : Bool)","def":{"name":"allow_multi_return=","args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_return = allow_multi_return"}},{"html_id":"allow_multi_return?:Bool-instance-method","name":"allow_multi_return?","abstract":false,"def":{"name":"allow_multi_return?","return_type":"Bool","visibility":"Public","body":"@allow_multi_return"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","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":112,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L112"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":108,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L108"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/6d03cef/src/ameba/rule/style/unless_else.cr#L45"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour if over unless with else\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```","summary":"

A rule that disallows the use of an else block with the unless.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/unless_else.cr#L45"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/unless_else.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if node.else.nop?\n return\nend\nlocation = node.location\ncond_end_location = node.cond.end_location\nelse_location = node.else_location\nend_location = node.end_location\nif ((location && cond_end_location) && else_location) && end_location\nelse\n issue_for(node, MSG)\n return\nend\nissue_for(location, cond_end_location, MSG) do |corrector|\n keyword_begin_pos = source.pos(location)\n keyword_end_pos = keyword_begin_pos + ({{ \"unless\".size }})\n keyword_range = keyword_begin_pos...keyword_end_pos\n cond_end_pos = source.pos(cond_end_location, end: true)\n else_begin_pos = source.pos(else_location)\n body_range = cond_end_pos...else_begin_pos\n else_end_pos = else_begin_pos + ({{ \"else\".size }})\n end_end_pos = source.pos(end_location, end: true)\n end_begin_pos = end_end_pos - ({{ \"end\".size }})\n else_range = else_end_pos...end_begin_pos\n corrector.replace(keyword_range, \"if\")\n corrector.replace(body_range, source.code[else_range])\n corrector.replace(else_range, source.code[body_range])\nend\n"}}]},{"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/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/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\""},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%s`\""}],"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"}],"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 ExcludeCallsWithBlock: 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeCallsWithBlock: 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","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/6d03cef/src/ameba/rule/style/verbose_block.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","abstract":false,"args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block?:Bool-instance-method","name":"exclude_calls_with_block?","abstract":false,"def":{"name":"exclude_calls_with_block?","return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","abstract":false,"args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks?:Bool-instance-method","name":"exclude_multiple_line_blocks?","abstract":false,"def":{"name":"exclude_multiple_line_blocks?","return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","abstract":false,"args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_operators?:Bool-instance-method","name":"exclude_operators?","abstract":false,"def":{"name":"exclude_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","abstract":false,"args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators?:Bool-instance-method","name":"exclude_prefix_operators?","abstract":false,"def":{"name":"exclude_prefix_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","abstract":false,"args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"html_id":"exclude_setters?:Bool-instance-method","name":"exclude_setters?","abstract":false,"def":{"name":"exclude_setters?","return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Union(Int32,Nil)-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Union(Int32,Nil))-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_length : Union(Int32, Nil))","args_html":"(max_length : Union(Int32, Nil))","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Union(Int32,Nil)-instance-method","name":"max_line_length","abstract":false,"def":{"name":"max_line_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Union(Int32,Nil))-instance-method","name":"max_line_length=","abstract":false,"args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_line_length : Union(Int32, Nil))","args_html":"(max_line_length : Union(Int32, Nil))","def":{"name":"max_line_length=","args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_line_length = max_line_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/verbose_block.cr#L215"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\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, block, body)\n"}}]},{"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/6d03cef/src/ameba/rule/style/while_true.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"While statement using true literal as condition\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/while_true.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::While)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/while_true.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if node.cond.true_literal?\nelse\n return\nend\nif location = node.location\nelse\n return\nend\nif end_location = node.cond.end_location\nelse\n return\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(location, end_location, \"loop do\")\nend\n"}}]}]}]},{"html_id":"ameba/Ameba/Runner","path":"Ameba/Runner.html","kind":"class","full_name":"Ameba::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/runner.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L12"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a runner for inspecting sources files.\nHolds a list of rules to do inspection based on,\nlist of sources to run inspection on and a formatter\nto prepare a report.\n\n```\nconfig = Ameba::Config.load\nrunner = Ameba::Runner.new config\nrunner.run.success? # => true or false\n```","summary":"

Represents a runner for inspecting sources files.

","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.

","abstract":false,"args":[{"name":"config","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","args_html":"(config : Config)","location":{"filename":"src/ameba/runner.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L61"},"def":{"name":"new","args":[{"name":"config","external_name":"config","restriction":"Config"}],"visibility":"Public","body":"_ = allocate\n_.initialize(config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"explain(location,output=STDOUT)-instance-method","name":"explain","doc":"Explains an issue at a specified *location*.\n\nRunner should perform inspection before doing the explain.\nThis is necessary to be able to find the issue at a specified location.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.explain({file: file, line: l, column: c})\n```","summary":"

Explains an issue at a specified location.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","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":160,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L160"},"def":{"name":"explain","args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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,"location":{"filename":"src/ameba/runner.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L87"},"def":{"name":"run","visibility":"Public","body":"begin\n @formatter.started(@sources)\n channels = @sources.map do\n Channel(Exception | ::Nil).new\n end\n (@sources.zip(channels)).each do |source, channel|\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,"location":{"filename":"src/ameba/runner.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L35"},"def":{"name":"sources","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,"location":{"filename":"src/ameba/runner.cr","line_number":172,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L172"},"def":{"name":"success?","visibility":"Public","body":"@sources.all? do |source|\n source.issues.reject(&.disabled?).none?() do |__arg7|\n __arg7.rule.severity <= @severity\n end\nend"}}],"types":[{"html_id":"ameba/Ameba/Runner/InfiniteCorrectionLoopError","path":"Ameba/Runner/InfiniteCorrectionLoopError.html","kind":"class","full_name":"Ameba::Runner::InfiniteCorrectionLoopError","name":"InfiniteCorrectionLoopError","abstract":false,"superclass":{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"ameba/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"ameba/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"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/runner.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Runner","kind":"class","full_name":"Ameba::Runner","name":"Runner"},"doc":"An error indicating that the inspection loop got stuck correcting\nissues back and forth.","summary":"

An error indicating that the inspection loop got stuck correcting issues back and forth.

","constructors":[{"html_id":"new(path,issues_by_iteration,loop_start=-1)-class-method","name":"new","abstract":false,"args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"args_string":"(path, issues_by_iteration, loop_start = -1)","args_html":"(path, issues_by_iteration, loop_start = -1)","location":{"filename":"src/ameba/runner.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L16"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(path, issues_by_iteration, loop_start)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]}]},{"html_id":"ameba/Ameba/Severity","path":"Ameba/Severity.html","kind":"enum","full_name":"Ameba::Severity","name":"Severity","abstract":false,"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":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Error","name":"Error","value":"0"},{"id":"Warning","name":"Warning","value":"1"},{"id":"Convention","name":"Convention","value":"2"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/severity.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L41"},"def":{"name":"parse","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"begin\n super(name)\nrescue ArgumentError\n raise(\"Incorrect severity name #{name}. Try one of: #{values.map(&.to_s).join(\", \")}\")\nend"}}],"instance_methods":[{"html_id":"color:Colorize::Color-instance-method","name":"color","doc":"Returns a color uniquely indicating severity.\n\n```\nSeverity::Warning.color # => Colorize::ColorANSI::Red\n```","summary":"

Returns a color uniquely indicating severity.

","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L27"},"def":{"name":"color","return_type":"Colorize::Color","visibility":"Public","body":"case self\nin Error\n Colorize::ColorANSI::Red\nin Warning\n Colorize::ColorANSI::Red\nin Convention\n Colorize::ColorANSI::Blue\nend"}},{"html_id":"convention?-instance-method","name":"convention?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L7"},"def":{"name":"convention?","visibility":"Public","body":"self == Convention"}},{"html_id":"error?-instance-method","name":"error?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L5"},"def":{"name":"error?","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,"location":{"filename":"src/ameba/severity.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L14"},"def":{"name":"symbol","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?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L6"},"def":{"name":"warning?","visibility":"Public","body":"self == Warning"}}]},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L49"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Converter for `YAML.mapping` which converts severity enum to and from YAML.","summary":"

Converter for YAML.mapping which converts severity enum to and from YAML.

","class_methods":[{"html_id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"from_yaml","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":{"filename":"src/ameba/severity.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L50"},"def":{"name":"from_yaml","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"if node.is_a?(YAML::Nodes::Scalar)\nelse\n raise(\"Severity must be a scalar, not #{node.class}\")\nend\ncase value = node.value\nwhen String\n Severity.parse(value)\nwhen Nil\n raise(\"Missing severity\")\nelse\n raise(\"Incorrect severity: #{value}\")\nend\n"}},{"html_id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","name":"to_yaml","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"args_string":"(value : Severity, yaml : YAML::Nodes::Builder)","args_html":"(value : Severity, yaml : YAML::Nodes::Builder)","location":{"filename":"src/ameba/severity.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L63"},"def":{"name":"to_yaml","args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"visibility":"Public","body":"yaml.scalar(value)"}}]},{"html_id":"ameba/Ameba/Source","path":"Ameba/Source.html","kind":"class","full_name":"Ameba::Source","name":"Source","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/source.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L4"},{"filename":"src/ameba/source/corrector.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L3"},{"filename":"src/ameba/source/rewriter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/support.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"An entity that represents a Crystal source file.\nHas path, lines of code and issues reported by rules.","summary":"

An entity that represents a Crystal source file.

","constructors":[{"html_id":"new(code:String,path:String=\"\",normalize=true)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"args_string":"(code : String, path : String = \"\", normalize = true)","args_html":"(code : String, path : String = "", normalize = true)","location":{"filename":"src/ameba/spec/support.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/support.cr#L11"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path, normalize)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(code:String,path:String=\"\")-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.

","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"args_string":"(code : String, path : String = \"\")","args_html":"(code : String, path : String = "")","location":{"filename":"src/ameba/source.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L22"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"ast:Crystal::ASTNode-instance-method","name":"ast","doc":"Returns AST nodes constructed by `Crystal::Parser`.\n\n```\nsource = Ameba::Source.new code, path\nsource.ast\n```","summary":"

Returns AST nodes constructed by Crystal::Parser.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L59"},"def":{"name":"ast","return_type":"Crystal::ASTNode","visibility":"Public","body":"if (value = @ast).nil?\n @ast = ((Crystal::Parser.new(code)).tap(&.wants_doc = true).tap(&.filename = path).parse)\nelse\n value\nend"}},{"html_id":"code:String-instance-method","name":"code","doc":"Crystal code (content of a source file).","summary":"

Crystal code (content of a source file).

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L12"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct?-instance-method","name":"correct?","doc":"Corrects any correctable issues and updates `code`.\nReturns `false` if no issues were corrected.","summary":"

Corrects any correctable issues and updates #code.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L27"},"def":{"name":"correct?","visibility":"Public","body":"corrector = Corrector.new(code)\nissues.each(&.correct(corrector))\ncorrected_code = corrector.process\nif code == corrected_code\n return false\nend\n@code = corrected_code\n@lines = nil\n@ast = nil\ntrue\n"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L66"},"def":{"name":"fullpath","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 split 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```","summary":"

Returns lines of code split by new line character.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L51"},"def":{"name":"lines","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` otherwise.","summary":"

Returns true if filepath matches the source's path, false otherwise.

","abstract":false,"args":[{"name":"filepath","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/ameba/source.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L76"},"def":{"name":"matches_path?","args":[{"name":"filepath","external_name":"filepath","restriction":""}],"visibility":"Public","body":"fullpath == (File.expand_path(filepath))"}},{"html_id":"path:String-instance-method","name":"path","doc":"Path to the source file.","summary":"

Path to the source file.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L9"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"pos(location:Crystal::Location,endend_pos=false):Int32-instance-method","name":"pos","doc":"Converts an AST location to a string position.","summary":"

Converts an AST location to a string position.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"args_string":"(location : Crystal::Location, end end_pos = false) : Int32","args_html":"(location : Crystal::Location, end end_pos = false) : Int32","location":{"filename":"src/ameba/source.cr","line_number":81,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L81"},"def":{"name":"pos","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"return_type":"Int32","visibility":"Public","body":"line, column = location.line_number, location.column_number\npos = ((lines[0...(line - 1)].sum(&.size) + line) + column) - 2\nif end_pos\n pos = pos + 1\nend\npos\n"}},{"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.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L71"},"def":{"name":"spec?","visibility":"Public","body":"path.ends_with?(\"_spec.cr\")"}}],"types":[{"html_id":"ameba/Ameba/Source/Corrector","path":"Ameba/Source/Corrector.html","kind":"class","full_name":"Ameba::Source::Corrector","name":"Corrector","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/source/corrector.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class takes source code and rewrites it based\non the different correction actions supplied.","summary":"

This class takes source code and rewrites it based on the different correction actions supplied.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/corrector.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L9"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"insert_after(location,end_location,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(location, end_location, nil, content)`","summary":"

Shortcut for #wrap(location, end_location, nil, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L65"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_after(range:Range(Int32,Int32),content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(range, nil, content)`","summary":"

Shortcut for #wrap(range, nil, content)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L70"},"def":{"name":"insert_after","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_after(begin_pos, end_pos, content)\n"}},{"html_id":"insert_after(pos:Int32,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(...pos, content)`","summary":"

Shortcut for #insert_after(...pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L92"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(pos, content)"}},{"html_id":"insert_after(node:Crystal::ASTNode,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(node, nil, content)`","summary":"

Shortcut for #wrap(node, nil, content)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":164,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L164"},"def":{"name":"insert_after","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(end_location(node), content)"}},{"html_id":"insert_after(location,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(location, location, content)`","summary":"

Shortcut for #insert_after(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L87"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after((loc_to_pos(location)) + 1, content)"}},{"html_id":"insert_before(location,end_location,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(location, end_location, content, nil)`","summary":"

Shortcut for #wrap(location, end_location, content, nil)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L53"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_before(range:Range(Int32,Int32),content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(range, content, nil)`","summary":"

Shortcut for #wrap(range, content, nil)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L58"},"def":{"name":"insert_before","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_before(begin_pos, end_pos, content)\n"}},{"html_id":"insert_before(pos:Int32,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos.., content)`","summary":"

Shortcut for #insert_before(pos.., content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":82,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L82"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(pos, content)"}},{"html_id":"insert_before(node:Crystal::ASTNode,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(node, content, nil)`","summary":"

Shortcut for #wrap(node, content, nil)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":159,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L159"},"def":{"name":"insert_before","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(location(node), content)"}},{"html_id":"insert_before(location,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(location, location, content)`","summary":"

Shortcut for #insert_before(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L77"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/corrector.cr","line_number":196,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L196"},"def":{"name":"process","visibility":"Public","body":"@rewriter.process"}},{"html_id":"remove(location,end_location)-instance-method","name":"remove","doc":"Shortcut for `replace(location, end_location, \"\")`","summary":"

Shortcut for #replace(location, end_location, "")

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"args_string":"(location, end_location)","args_html":"(location, end_location)","location":{"filename":"src/ameba/source/corrector.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L41"},"def":{"name":"remove","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove(range:Range(Int32,Int32))-instance-method","name":"remove","doc":"Shortcut for `replace(range, \"\")`","summary":"

Shortcut for #replace(range, "")

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"args_string":"(range : Range(Int32, Int32))","args_html":"(range : Range(Int32, Int32))","location":{"filename":"src/ameba/source/corrector.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L46"},"def":{"name":"remove","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(begin_pos, end_pos)\n"}},{"html_id":"remove(node:Crystal::ASTNode)-instance-method","name":"remove","doc":"Shortcut for `replace(node, \"\")`","summary":"

Shortcut for #replace(node, "")

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/source/corrector.cr","line_number":154,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L154"},"def":{"name":"remove","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"remove(location(node), end_location(node))"}},{"html_id":"remove_leading(location,end_location,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L110"},"def":{"name":"remove_leading","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(location)) + size)"}},{"html_id":"remove_leading(range:Range(Int32,Int32),size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L115"},"def":{"name":"remove_leading","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos, begin_pos + size)\n"}},{"html_id":"remove_leading(node:Crystal::ASTNode,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the end of the node.","summary":"

Removes size characters from the beginning of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":176,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L176"},"def":{"name":"remove_leading","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_leading(location(node), end_location(node), size)"}},{"html_id":"remove_preceding(location,end_location,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L97"},"def":{"name":"remove_preceding","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove((loc_to_pos(location)) - size, loc_to_pos(location))"}},{"html_id":"remove_preceding(range:Range(Int32,Int32),size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L102"},"def":{"name":"remove_preceding","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos - size, begin_pos)\n"}},{"html_id":"remove_preceding(node:Crystal::ASTNode,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the given node.","summary":"

Removes size characters prior to the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":169,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L169"},"def":{"name":"remove_preceding","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_preceding(location(node), end_location(node), size)"}},{"html_id":"remove_trailing(location,end_location,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":123,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L123"},"def":{"name":"remove_trailing","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(((loc_to_pos(end_location)) + 1) - size, (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove_trailing(range:Range(Int32,Int32),size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":128,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L128"},"def":{"name":"remove_trailing","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"end_pos = range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(end_pos - size, end_pos)\n"}},{"html_id":"remove_trailing(node:Crystal::ASTNode,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the beginning of the node.","summary":"

Removes size characters from the end of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L183"},"def":{"name":"remove_trailing","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_trailing(location(node), end_location(node), size)"}},{"html_id":"replace(location,end_location,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L17"},"def":{"name":"replace","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.replace(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"replace(range:Range(Int32,Int32),content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L22"},"def":{"name":"replace","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.replace(begin_pos, end_pos, content)\n"}},{"html_id":"replace(node:Crystal::ASTNode,content)-instance-method","name":"replace","doc":"Replaces the code of the given node with *content*.","summary":"

Replaces the code of the given node with content.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":144,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L144"},"def":{"name":"replace","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"replace(location(node), end_location(node), content)"}},{"html_id":"wrap(location,end_location,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(location, end_location, insert_before, insert_after)","args_html":"(location, end_location, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L29"},"def":{"name":"wrap","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"@rewriter.wrap(loc_to_pos(location), (loc_to_pos(end_location)) + 1, insert_before, insert_after)"}},{"html_id":"wrap(range:Range(Int32,Int32),insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(range : Range(Int32, Int32), insert_before, insert_after)","args_html":"(range : Range(Int32, Int32), insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L34"},"def":{"name":"wrap","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.wrap(begin_pos, end_pos, insert_before, insert_after)\n"}},{"html_id":"wrap(node:Crystal::ASTNode,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given node.","summary":"

Inserts the given strings before and after the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(node : Crystal::ASTNode, insert_before, insert_after)","args_html":"(node : Crystal::ASTNode, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":149,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L149"},"def":{"name":"wrap","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"wrap(location(node), end_location(node), insert_before, insert_after)"}}]},{"html_id":"ameba/Ameba/Source/Rewriter","path":"Ameba/Source/Rewriter.html","kind":"class","full_name":"Ameba::Source::Rewriter","name":"Rewriter","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/source/rewriter.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L61"},{"filename":"src/ameba/source/rewriter/action.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter/action.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class performs the heavy lifting in the source rewriting process.\nIt schedules code updates to be performed in the correct order.\n\nFor simple cases, the resulting source will be obvious.\n\nExamples for more complex cases follow. Assume these examples are acting on\nthe source `puts(:hello, :world)`. The methods `#wrap`, `#remove`, etc.\nreceive a range as the first two arguments; for clarity, examples below use\nEnglish sentences and a string of raw code instead.\n\n## Overlapping deletions:\n\n* remove `:hello, `\n* remove `, :world`\n\nThe overlapping ranges are merged and `:hello, :world` will be removed.\n\n## Multiple actions at the same end points:\n\nResults will always be independent of the order they were given.\nException: rewriting actions done on exactly the same range (covered next).\n\nExample:\n\n* replace `, ` by ` => `\n* wrap `:hello, :world` with `{` and `}`\n* replace `:world` with `:everybody`\n* wrap `:world` with `[`, `]`\n\nThe resulting string will be `puts({:hello => [:everybody]})`\nand this result is independent of the order the instructions were given in.\n\n## Multiple wraps on same range:\n\n* wrap `:hello` with `(` and `)`\n* wrap `:hello` with `[` and `]`\n\nThe wraps are combined in order given and results would be `puts([(:hello)], :world)`.\n\n## Multiple replacements on same range:\n\n* replace `:hello` by `:hi`, then\n* replace `:hello` by `:hey`\n\nThe replacements are made in the order given, so the latter replacement\nsupersedes the former and `:hello` will be replaced by `:hey`.\n\n## Swallowed insertions:\n\n* wrap `world` by `__`, `__`\n* replace `:hello, :world` with `:hi`\n\nA containing replacement will swallow the contained rewriting actions\nand `:hello, :world` will be replaced by `:hi`.\n\n## Implementation\n\nThe updates are organized in a tree, according to the ranges they act on\n(where children are strictly contained by their parent).","summary":"

This class performs the heavy lifting in the source rewriting process.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L64"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L62"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"empty?-instance-method","name":"empty?","doc":"Returns `true` if no (non trivial) update has been recorded","summary":"

Returns true if no (non trivial) update has been recorded

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L69"},"def":{"name":"empty?","visibility":"Public","body":"@action_root.empty?"}},{"html_id":"insert_after(begin_pos,end_pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(begin_pos, end_pos, nil, content)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, nil, content)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L97"},"def":{"name":"insert_after","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, nil, content)"}},{"html_id":"insert_after(pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(pos, pos, content)`","summary":"

Shortcut for #insert_after(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":107,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L107"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(pos, pos, content)"}},{"html_id":"insert_before(begin_pos,end_pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(begin_pos, end_pos, content, nil)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, content, nil)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L92"},"def":{"name":"insert_before","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, content, nil)"}},{"html_id":"insert_before(pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos, pos, content)`","summary":"

Shortcut for #insert_before(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L102"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(pos, pos, content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L112"},"def":{"name":"process","visibility":"Public","body":"String.build do |io|\n last_end = 0\n @action_root.ordered_replacements.each do |begin_pos, end_pos, replacement|\n (io << code[last_end...begin_pos]) << replacement\n last_end = end_pos\n end\n io << code[last_end...code.size]\nend"}},{"html_id":"remove(begin_pos,end_pos)-instance-method","name":"remove","doc":"Shortcut for `replace(begin_pos, end_pos, \"\")`","summary":"

Shortcut for #replace(begin_pos, end_pos, "")

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"args_string":"(begin_pos, end_pos)","args_html":"(begin_pos, end_pos)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L87"},"def":{"name":"remove","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"visibility":"Public","body":"replace(begin_pos, end_pos, \"\")"}},{"html_id":"replace(begin_pos,end_pos,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L74"},"def":{"name":"replace","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, replacement: content.to_s)"}},{"html_id":"wrap(begin_pos,end_pos,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(begin_pos, end_pos, insert_before, insert_after)","args_html":"(begin_pos, end_pos, insert_before, insert_after)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L80"},"def":{"name":"wrap","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, insert_before: insert_before.to_s, insert_after: insert_after.to_s)"}}]}]},{"html_id":"ameba/Ameba/Spec","path":"Ameba/Spec.html","kind":"module","full_name":"Ameba::Spec","name":"Spec","abstract":false,"locations":[{"filename":"src/ameba/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L2"},{"filename":"src/ameba/spec/be_valid.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Spec/AnnotatedSource","path":"Ameba/Spec/AnnotatedSource.html","kind":"class","full_name":"Ameba::Spec::AnnotatedSource","name":"AnnotatedSource","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/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ABBREV","name":"ABBREV","value":"\"[...]\""},{"id":"ANNOTATION_PATTERN_1","name":"ANNOTATION_PATTERN_1","value":"/\\A\\s*(# )?(\\^+|\\^{})( error:)? /"},{"id":"ANNOTATION_PATTERN_2","name":"ANNOTATION_PATTERN_2","value":"\" # error: \""}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Parsed representation of code annotated with the `# ^^^ error: Message` style","summary":"

Parsed representation of code annotated with the # ^^^ error: Message style

","class_methods":[{"html_id":"parse(annotated_code)-class-method","name":"parse","doc":"Separates annotation lines from code lines. Tracks the real\ncode line number that each annotation corresponds to.","summary":"

Separates annotation lines from code lines.

","abstract":false,"args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"args_string":"(annotated_code)","args_html":"(annotated_code)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L16"},"def":{"name":"parse","args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"visibility":"Public","body":"lines = [] of String\nannotations = [] of ::Tuple(Int32, String, String)\ncode_lines = annotated_code.split('\\n')\ncode_lines.each do |code_line|\n case\n when 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 when 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\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:Array(String),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.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"args_string":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","args_html":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L43"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lines, annotations)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(lines:Array(String),issues:Enumerable(Issue))-class-method","name":"new","doc":"Annotates the source code with the Ameba issues provided.\n\nNOTE: Annotations are sorted so that reconstructing the annotation\n text via `#to_s` is deterministic.","summary":"

Annotates the source code with the Ameba issues provided.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"args_string":"(lines : Array(String), issues : Enumerable(Issue))","args_html":"(lines : Array(String), issues : Enumerable(Issue))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L53"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L59"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"(other.is_a?(AnnotatedSource) && (other.lines == lines)) && (match_annotations?(other))"}},{"html_id":"annotations:Array(Tuple(Int32,String,String))-instance-method","name":"annotations","doc":"Each entry is the line number, annotation prefix, and message.\nThe prefix is empty if the annotation is at the end of a code line.","summary":"

Each entry is the line number, annotation prefix, and message.

","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L12"},"def":{"name":"annotations","return_type":"Array(::Tuple(Int32, String, String))","visibility":"Public","body":"@annotations"}},{"html_id":"lines:Array(String)-instance-method","name":"lines","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L8"},"def":{"name":"lines","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","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L110"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"reconstructed = lines.dup\nannotations.reverse_each do |line_number, prefix, message|\n if prefix.empty?\n __temp_62 = line_number - 1\n reconstructed[__temp_62] = reconstructed[__temp_62] + \"#{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"}}]},{"html_id":"ameba/Ameba/Spec/BeValid","path":"Ameba/Spec/BeValid.html","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid","abstract":false,"locations":[{"filename":"src/ameba/spec/be_valid.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"instance_methods":[{"html_id":"be_valid-instance-method","name":"be_valid","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L3"},"def":{"name":"be_valid","visibility":"Public","body":"BeValidExpectation.new"}}]},{"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/6d03cef/src/ameba/spec/be_valid.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"new","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","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/spec/be_valid.cr#L13"},"def":{"name":"failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"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 |issue|\n str << \" * #{issue.rule.name}: #{issue.message}\\n\"\n end\nend"}},{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"initialize","visibility":"Public","body":""}},{"html_id":"match(source)-instance-method","name":"match","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/spec/be_valid.cr#L9"},"def":{"name":"match","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.valid?"}},{"html_id":"negative_failure_message(source)-instance-method","name":"negative_failure_message","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/spec/be_valid.cr#L22"},"def":{"name":"negative_failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"\"Source expected to be invalid, but it is valid.\""}}]},{"html_id":"ameba/Ameba/Spec/ExpectIssue","path":"Ameba/Spec/ExpectIssue.html","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue","abstract":false,"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":96,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Mixin for `expect_issue` and `expect_no_issues`\n\nThis 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, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\nEquivalent assertion without `expect_issue`:\n\n source = Source.new <<-CRYSTAL, \"source.cr\"\n a do\n b\n end.c\n CRYSTAL\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:3:1\"\n issue.end_location.to_s.should eq \"source.cr:3:5\"\n issue.message.should eq(\n \"Avoid chaining a method call on a do...end block.\"\n )\n\nAutocorrection can be tested using `expect_correction` after\n`expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n x % 2 == 0\n # ^^^^^^^^ error: Replace with `Int#even?`.\n CRYSTAL\n\n expect_correction source, <<-CRYSTAL\n x.even?\n CRYSTAL\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.\n\nIf the code produces an issue that could not be auto-corrected, you can\nuse `expect_no_corrections` after `expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\n expect_no_corrections source\n\nIf your code has variables of different lengths, you can use `%{foo}`,\n`^{foo}`, and `_{foo}` to format your template; you can also abbreviate\nissue messages with `[...]`:\n\n %w[raise fail].each do |keyword|\n expect_issue subject, <<-CRYSTAL, keyword: keyword\n %{keyword} Exception.new(msg)\n # ^{keyword}^^^^^^^^^^^^^^^^^ error: Redundant `Exception.new` [...]\n CRYSTAL\n\n %w[has_one has_many].each do |type|\n expect_issue subject, <<-CRYSTAL, type: type\n class Book\n %{type} :chapter, foreign_key: \"book_id\"\n _{type} # ^^^^^^^^^^^^^^^^^^^^^^ error: Specifying the default [...]\n end\n CRYSTAL\n end\n\nIf you need to specify an issue on a blank line, use the empty `^{}` marker:\n\n expect_issue subject, <<-CRYSTAL\n\n # ^{} error: Missing frozen string literal comment.\n puts 1\n CRYSTAL","summary":"

Mixin for #expect_issue and #expect_no_issues

","instance_methods":[{"html_id":"expect_correction(source,correction,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_correction","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, correction, *, file = __FILE__, line = __LINE__)","args_html":"(source, correction, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":131,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L131"},"def":{"name":"expect_correction","args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":2,"visibility":"Public","body":"if source.correct?\nelse\n raise(\"Use `expect_no_corrections` if the code will not change\")\nend\nif correction == source.code\n return\nend\nfail(\"Expected correction:\\n\\n#{correction}\\n\\nGot:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_issue(rules:Rule::Base|Enumerable(Rule::Base),annotated_code:String,path=\"\",*,file=__FILE__,line=__LINE__,**replacements)-instance-method","name":"expect_issue","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = \"\", *, file = __FILE__, line = __LINE__, **replacements)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = "", *, file = __FILE__, line = __LINE__, **replacements)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L99"},"def":{"name":"expect_issue","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":{"name":"replacements","external_name":"replacements","restriction":""},"splat_index":3,"visibility":"Public","body":"annotated_code = format_issue(annotated_code, **replacements)\nexpected_annotations = AnnotatedSource.parse(annotated_code)\nlines = expected_annotations.lines\ncode = lines.join('\\n')\nif code == annotated_code\n raise(\"Use `expect_no_issues` to assert that no issues are found\")\nend\nsource, actual_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\nsource\n"}},{"html_id":"expect_no_corrections(source,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_corrections","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, *, file = __FILE__, line = __LINE__)","args_html":"(source, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L146"},"def":{"name":"expect_no_corrections","args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":1,"visibility":"Public","body":"if source.correct?\nelse\n return\nend\nfail(\"Expected no corrections, but got:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_no_issues(rules:Rule::Base|Enumerable(Rule::Base),code:String,path=\"\",*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_issues","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = \"\", *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = "", *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L156"},"def":{"name":"expect_no_issues","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":3,"visibility":"Public","body":"lines = code.split('\\n')\n_, actual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations.to_s == code\n return\nend\nfail(\"Expected no issues, but got:\\n\\n#{actual_annotations}\", file, line)\n"}}]},{"html_id":"ameba/Ameba/Spec/Util","path":"Ameba/Spec/Util.html","kind":"module","full_name":"Ameba::Spec::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/spec/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"},"instance_methods":[{"html_id":"normalize_code(code,separator='\\n')-instance-method","name":"normalize_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","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/6d03cef/src/ameba/spec/util.cr#L2"},"def":{"name":"normalize_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","default_value":"'\\n'","external_name":"separator","restriction":""}],"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"}}]}]},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

Represents Crystal syntax tokenizer based on Crystal::Lexer.

","constructors":[{"html_id":"new(lexer:Crystal::Lexer)-class-method","name":"new","doc":"Instantiates Tokenizer using a `lexer`.\n\n```\nlexer = Crystal::Lexer.new(code)\nAmeba::Tokenizer.new(lexer)\n```","summary":"

Instantiates Tokenizer using a lexer.

","abstract":false,"args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"args_string":"(lexer : Crystal::Lexer)","args_html":"(lexer : Crystal::Lexer)","location":{"filename":"src/ameba/tokenizer.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L34"},"def":{"name":"new","args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lexer)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(source)-class-method","name":"new","doc":"Instantiates Tokenizer using a `source`.\n\n```\nsource = Ameba::Source.new code, path\nAmeba::Tokenizer.new(source)\n```","summary":"

Instantiates Tokenizer using a source.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/tokenizer.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L20"},"def":{"name":"new","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"run(&block:Crystal::Token->_)-instance-method","name":"run","doc":"Runs the tokenizer and yields each token as a block argument.\n\n```\nAmeba::Tokenizer.new(source).run do |token|\n puts token\nend\n```","summary":"

Runs the tokenizer and yields each token as a block argument.

","abstract":false,"location":{"filename":"src/ameba/tokenizer.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L44"},"def":{"name":"run","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crystal::Token -> _)"},"visibility":"Public","body":"begin\n run_normal_state(@lexer, &block)\n true\nrescue e : Crystal::SyntaxException\n false\nend"}}]}]}]}} \ No newline at end of file diff --git a/search-index.js b/search-index.js index 35a36028..6486f4ab 100644 --- a/search-index.js +++ b/search-index.js @@ -1 +1 @@ -crystal_doc_search_index_callback({"repository_name":"ameba","body":"

\n \n

Ameba

\n

Code style linter for Crystal

\n

\n \n (a single-celled animal that catches food and moves about by extending fingerlike projections of protoplasm)\n \n

\n

\n \n \n \n

\n

\n\n- [About](#about)\n- [Usage](#usage)\n - [Watch a tutorial](#watch-a-tutorial)\n - [Autocorrection](#autocorrection)\n - [Explain issues](#explain-issues)\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 - [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.....................FF....................................................................\n\nsrc/ameba/formatter/flycheck_formatter.cr:6:37\n[W] Lint/UnusedArgument: Unused argument `location`. If it's necessary, use `_` as an argument name to indicate that it won't be used.\n> source.issues.each do |issue, location|\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:14\n[W] Lint/UselessAssign: Useless assignment to variable `s`\n> return s += issues.size\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:7 [Correctable]\n[C] Style/RedundantReturn: Redundant `return` detected\n> return s += issues.size\n ^---------------------^\n\nFinished in 389.45 milliseconds\n107 inspected, 3 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### Autocorrection\n\nRules that are marked as `[Correctable]` in the output can be automatically corrected using `--fix` flag:\n\n```sh\n$ ameba --fix\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### Run in parallel\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```\n\nBuild `bin/ameba` binary within your project directory while running `shards install`.\n\n### OS X\n\n```sh\n$ brew tap crystal-ameba/ameba\n$ brew install ameba\n```\n\n### Docker\n\nBuild the image:\n\n```sh\n$ docker build -t ghcr.io/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 ghcr.io/crystal-ameba/ameba\n```\n\nAlso available on GitHub: https://github.com/crystal-ameba/ameba/pkgs/container/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### 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\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- [Sija](https://github.com/Sija) Sijawusz Pur Rahnama - contributor, maintainer\n","program":{"html_id":"ameba/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"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,"const":false,"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"}],"types":[{"html_id":"ameba/Ameba","path":"Ameba.html","kind":"module","full_name":"Ameba","name":"Ameba","abstract":false,"locations":[{"filename":"src/ameba.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba.cr#L26"},{"filename":"src/ameba/glob_utils.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/glob_utils.cr#L1"},{"filename":"src/ameba/inline_comments.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L1"},{"filename":"src/ameba/issue.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L1"},{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L3"},{"filename":"src/ameba/runner.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L1"},{"filename":"src/ameba/severity.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L3"},{"filename":"src/ameba/source.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/support.cr#L7"},{"filename":"src/ameba/tokenizer.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/ameba/ameba/src\\\"`).chomp.stringify }}"}],"extended_modules":[{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"}],"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.

","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.

","abstract":false,"args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"args_string":"(config = Config.load)","args_html":"(config = Config.load)","location":{"filename":"src/ameba.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba.cr#L40"},"def":{"name":"run","args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"visibility":"Public","body":"(Runner.new(config)).run"}}],"types":[{"html_id":"ameba/Ameba/AST","path":"Ameba/AST.html","kind":"module","full_name":"Ameba::AST","name":"AST","abstract":false,"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L3"},{"filename":"src/ameba/ast/branchable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L3"},{"filename":"src/ameba/ast/flow_expression.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L3"},{"filename":"src/ameba/ast/scope.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L3"},{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L2"},{"filename":"src/ameba/ast/variabling/argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L1"},{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L4"},{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L1"},{"filename":"src/ameba/ast/variabling/reference.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/reference.cr#L3"},{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L1"},{"filename":"src/ameba/ast/variabling/variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L1"},{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/flow_expression_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/scope_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","types":[{"html_id":"ameba/Ameba/AST/Argument","path":"Ameba/AST/Argument.html","kind":"class","full_name":"Ameba::AST::Argument","name":"Argument","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/variabling/argument.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the argument of some node.\nHolds the reference to the variable, thus to scope.\n\nFor example, all these vars are arguments:\n\n```\ndef method(a, b, c = 10, &block)\n 3.times do |i|\n end\n\n ->(x : Int32) {}\nend\n```","summary":"

Represents the argument of some node.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"visibility":"Public","body":"_ = allocate\n_.initialize(node, variable)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"anonymous?-instance-method","name":"anonymous?","doc":"Returns `true` if the `name` is empty, `false` otherwise.","summary":"

Returns true if the #name is empty, false otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L34"},"def":{"name":"anonymous?","visibility":"Public","body":"name.blank?"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L39"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L44"},"def":{"name":"name","visibility":"Public","body":"case current_node = node\nwhen Crystal::Var, 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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L17"},"def":{"name":"node","return_type":"Crystal::Var | Crystal::Arg","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/argument.cr#L20"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::Variable,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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|Nil-instance-method","name":"branch","doc":"Branch of this assignment.","summary":"

Branch of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L57"},"def":{"name":"in_branch?","visibility":"Public","body":"!branch.nil?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L47"},"def":{"name":"op_assign?","visibility":"Public","body":"node.is_a?(Crystal::OpAssign)"}},{"html_id":"referenced=(referenced:Bool)-instance-method","name":"referenced=","abstract":false,"args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"args_string":"(referenced : Bool)","args_html":"(referenced : Bool)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced=","args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"visibility":"Public","body":"@referenced = referenced"}},{"html_id":"referenced?:Bool-instance-method","name":"referenced?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","visibility":"Public","body":"@referenced"}},{"html_id":"referenced_in_loop?-instance-method","name":"referenced_in_loop?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L37"},"def":{"name":"referenced_in_loop?","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L62"},"def":{"name":"target_node","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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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 assignment.","summary":"

Variable of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/assignment.cr#L14"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::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","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L18"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/base_visitor.cr#L24"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"true"}}]},{"html_id":"ameba/Ameba/AST/Branch","path":"Ameba/AST/Branch.html","kind":"class","full_name":"Ameba::AST::Branch","name":"Branch","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the branch in Crystal code.\nBranch is a part of a branchable statement.\nFor example, the branchable if statement contains 3 branches:\n\n```\nif a = something # --> Branch A\n a = 1 # --> Branch B\n put a if out # --> Branch C\nelse\n do_something a # --> Branch D\nend\n```","summary":"

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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branch.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L66"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::ASTNode, scope : Scope)","args_html":"(node : Crystal::ASTNode, scope : Scope)","location":{"filename":"src/ameba/ast/branch.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L57"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"of(node, scope.node)"}}],"constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Ameba::AST::Branchable)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","args_html":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","location":{"filename":"src/ameba/ast/branch.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L34"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_loop?-instance-method","name":"in_loop?","doc":"Returns `true` if current branch is in a loop, `false` - otherwise.\nFor example, this branch is in a loop:\n\n```\nwhile true\n handle_input # this branch is in a loop\n if wrong_input\n show_message # this branch is also in a loop.\n end\nend\n```","summary":"

Returns true if current branch is in a loop, false - otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/branch.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L48"},"def":{"name":"in_loop?","visibility":"Public","body":"@parent.loop?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L18"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branch.cr#L21"},"def":{"name":"parent","return_type":"Branchable","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/e6a5fa9/src/ameba/ast/branchable.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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```\nwhile 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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Nil|Ameba::AST::Branchable=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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","args_html":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"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":"Array of branches","summary":"

Array of branches

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L22"},"def":{"name":"branches","visibility":"Public","body":"@branches"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L41"},"def":{"name":"loop?","visibility":"Public","body":"(loop?(node)) || (!(!parent.try(&.loop?)))"}},{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual Crystal node","summary":"

The actual Crystal node

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"parent:Branchable|Nil-instance-method","name":"parent","doc":"Parent branchable (if any)","summary":"

Parent branchable (if any)

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/branchable.cr#L19"},"def":{"name":"parent","return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_COMPLEXITY","name":"DEFAULT_COMPLEXITY","value":"1"}],"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

","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","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L9"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L19"},"def":{"name":"count","visibility":"Public","body":"@scope.accept(self)\n@complexity\n"}},{"html_id":"macro_condition?:Bool-instance-method","name":"macro_condition?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L6"},"def":{"name":"macro_condition?","visibility":"Public","body":"@macro_condition"}},{"html_id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","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":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/counting_visitor.cr#L45"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"visibility":"Public","body":"@macro_condition = true\n@complexity = DEFAULT_COMPLEXITY\nfalse\n"}}]},{"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/e6a5fa9/src/ameba/ast/flow_expression.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,in_loop:Bool)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"args_string":"(node : Crystal::ASTNode, in_loop : Bool)","args_html":"(node : Crystal::ASTNode, in_loop : Bool)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/flow_expression.cr#L50"},"def":{"name":"unreachable_nodes","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 = (!(loop?(exp))) && (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"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

"},{"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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::InstanceVar)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"node:Crystal::InstanceVar-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{Alias, Assign, Block, Call, Case, ClassDef, ClassVar, Def, EnumDef, ExceptionHandler, Expressions, HashLiteral, If, InstanceVar, IsA, LibDef, ModuleDef, MultiAssign, NilLiteral, StringInterpolation, Unless, Until, Var, When, While}","doc":"List of nodes to be visited by Ameba's rules.","summary":"

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

"}],"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```","summary":"

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

","class_methods":[{"html_id":"category_to_node_classes(category:Category)-class-method","name":"category_to_node_classes","abstract":false,"args":[{"name":"category","external_name":"category","restriction":"Category"}],"args_string":"(category : Category)","args_html":"(category : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L47"},"def":{"name":"category_to_node_classes","args":[{"name":"category","external_name":"category","restriction":"Category"}],"visibility":"Public","body":"([] of Crystal::ASTNode.class).tap do |classes|\n if category.macro?\n classes.push(Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor)\n end\nend"}}],"constructors":[{"html_id":"new(rule,source,*,skip:Category)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"args_string":"(rule, source, *, skip : Category)","args_html":"(rule, source, *, skip : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L58"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(rule,source,*,skip:Array|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"args_string":"(rule, source, *, skip : Array | Nil = nil)","args_html":"(rule, source, *, skip : Array | Nil = nil)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L63"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"visit(node:Crystal::VisibilityModifier)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"args_string":"(node : Crystal::VisibilityModifier)","args_html":"(node : Crystal::VisibilityModifier)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L68"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"visibility":"Public","body":"node.exp.visibility = node.modifier\ntrue\n"}},{"html_id":"visit(node:Crystal::Alias)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Alias` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Alias node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(node : Crystal::Alias)","args_html":"(node : Crystal::Alias)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Assign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Assign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Assign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(node : Crystal::Assign)","args_html":"(node : Crystal::Assign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Block)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Block` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Block node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(node : Crystal::Block)","args_html":"(node : Crystal::Block)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Call)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Call` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Call node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(node : Crystal::Call)","args_html":"(node : Crystal::Call)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Case)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Case` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Case node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(node : Crystal::Case)","args_html":"(node : Crystal::Case)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(node : Crystal::ClassDef)","args_html":"(node : Crystal::ClassDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(node : Crystal::ClassVar)","args_html":"(node : Crystal::ClassVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Def)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Def` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Def node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(node : Crystal::Def)","args_html":"(node : Crystal::Def)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::EnumDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::EnumDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::EnumDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(node : Crystal::EnumDef)","args_html":"(node : Crystal::EnumDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ExceptionHandler)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ExceptionHandler` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ExceptionHandler node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(node : Crystal::ExceptionHandler)","args_html":"(node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Expressions` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Expressions node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(node : Crystal::Expressions)","args_html":"(node : Crystal::Expressions)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::HashLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::HashLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::HashLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(node : Crystal::HashLiteral)","args_html":"(node : Crystal::HashLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::If)-instance-method","name":"visit","doc":"A visit callback for `Crystal::If` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::If node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"args_string":"(node : Crystal::If)","args_html":"(node : Crystal::If)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::InstanceVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::InstanceVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::InstanceVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::IsA)-instance-method","name":"visit","doc":"A visit callback for `Crystal::IsA` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::IsA node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(node : Crystal::IsA)","args_html":"(node : Crystal::IsA)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::LibDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::LibDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::LibDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(node : Crystal::LibDef)","args_html":"(node : Crystal::LibDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ModuleDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ModuleDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ModuleDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(node : Crystal::ModuleDef)","args_html":"(node : Crystal::ModuleDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::MultiAssign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::MultiAssign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::MultiAssign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(node : Crystal::MultiAssign)","args_html":"(node : Crystal::MultiAssign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::NilLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::NilLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::NilLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(node : Crystal::NilLiteral)","args_html":"(node : Crystal::NilLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::StringInterpolation)-instance-method","name":"visit","doc":"A visit callback for `Crystal::StringInterpolation` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::StringInterpolation node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(node : Crystal::StringInterpolation)","args_html":"(node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Unless)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Unless` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Unless node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(node : Crystal::Unless)","args_html":"(node : Crystal::Unless)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Until)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Until` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Until node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(node : Crystal::Until)","args_html":"(node : Crystal::Until)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Var)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Var` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Var node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(node : Crystal::Var)","args_html":"(node : Crystal::Var)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::When)-instance-method","name":"visit","doc":"A visit callback for `Crystal::When` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::When node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"args_string":"(node : Crystal::When)","args_html":"(node : Crystal::When)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::While)-instance-method","name":"visit","doc":"A visit callback for `Crystal::While` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::While node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(node : Crystal::While)","args_html":"(node : Crystal::While)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":86,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L86"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"!(skip?(node))"}}],"types":[{"html_id":"ameba/Ameba/AST/NodeVisitor/Category","path":"Ameba/AST/NodeVisitor/Category.html","kind":"enum","full_name":"Ameba::AST::NodeVisitor::Category","name":"Category","abstract":false,"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/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L12"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Macro","name":"Macro","value":"1"},{"id":"None","name":"None","value":"0"},{"id":"All","name":"All","value":"1"}],"namespace":{"html_id":"ameba/Ameba/AST/NodeVisitor","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor"},"instance_methods":[{"html_id":"macro?-instance-method","name":"macro?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L13"},"def":{"name":"macro?","visibility":"Public","body":"self.includes?(Macro)"}},{"html_id":"none?-instance-method","name":"none?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/node_visitor.cr#L12"},"def":{"name":"none?","visibility":"Public","body":"value == 0"}}]}]},{"html_id":"ameba/Ameba/AST/RedundantControlExpressionVisitor","path":"Ameba/AST/RedundantControlExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::RedundantControlExpressionVisitor","name":"RedundantControlExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A class that utilizes a logic to traverse AST nodes and\nfire a source test callback if a redundant `Crystal::ControlExpression`\nis reached.","summary":"

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

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::Source,node:Crystal::ASTNode)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L15"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"A node to run traversal on.","summary":"

A node to run traversal on.

","abstract":false,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"def":{"name":"source","return_type":"Source","visibility":"Public","body":"@source"}}]},{"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/e6a5fa9/src/ameba/ast/variabling/reference.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","instance_methods":[{"html_id":"explicit=(explicit:Bool)-instance-method","name":"explicit=","abstract":false,"args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"args_string":"(explicit : Bool)","args_html":"(explicit : Bool)","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit=","args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"visibility":"Public","body":"@explicit = explicit"}},{"html_id":"explicit?:Bool-instance-method","name":"explicit?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit?","visibility":"Public","body":"@explicit"}}]},{"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/e6a5fa9/src/ameba/ast/scope.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,outer_scope:Nil|Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","args_html":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L47"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"add_argument(node)-instance-method","name":"add_argument","doc":"Creates a new argument in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_argument(arg_node)\n```","summary":"

Creates a new argument in the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L67"},"def":{"name":"add_argument","args":[{"name":"node","external_name":"node","restriction":""}],"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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L78"},"def":{"name":"add_ivariable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"ivariables << (InstanceVariable.new(node))"}},{"html_id":"add_type_dec_variable(node)-instance-method","name":"add_type_dec_variable","doc":"Adds a new type declaration variable to the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_type_dec_variable(node)\n```","summary":"

Adds a new type declaration variable to the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":88,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L88"},"def":{"name":"add_type_dec_variable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"type_dec_variables << (TypeDecVariable.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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L57"},"def":{"name":"add_variable","args":[{"name":"node","external_name":"node","restriction":""}],"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` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"var","external_name":"var","restriction":""}],"args_string":"(var)","args_html":"(var)","location":{"filename":"src/ameba/ast/scope.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L199"},"def":{"name":"arg?","args":[{"name":"var","external_name":"var","restriction":""}],"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L20"},"def":{"name":"arguments","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","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"args_string":"(name, node)","args_html":"(name, node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":109,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L109"},"def":{"name":"assign_variable","args":[{"name":"name","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(find_variable(name)).try(&.assign(node, self))"}},{"html_id":"assigns_ivar?(name)-instance-method","name":"assigns_ivar?","doc":"Returns `true` if instance variable is assigned in this scope.","summary":"

Returns true if instance variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":140,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L140"},"def":{"name":"assigns_ivar?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"arguments.any?() do |__arg7|\n __arg7.name == name\nend && ivariables.any?() do |__arg8|\n __arg8.name == \"@#{name}\"\nend"}},{"html_id":"assigns_type_dec?(name)-instance-method","name":"assigns_type_dec?","doc":"Returns `true` if type declaration variable is assigned in this scope.","summary":"

Returns true if type declaration variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L146"},"def":{"name":"assigns_type_dec?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"type_dec_variables.any?() do |__arg9|\n __arg9.name == name\nend || (!(!outer_scope.try(&.assigns_type_dec?(name))))"}},{"html_id":"block?-instance-method","name":"block?","doc":"Returns `true` if current scope represents a block (or proc),\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L115"},"def":{"name":"block?","visibility":"Public","body":"node.is_a?(Crystal::Block) || node.is_a?(Crystal::ProcLiteral)"}},{"html_id":"class_def?(*,check_outer_scopes=false)-instance-method","name":"class_def?","doc":"Returns `true` if current scope is a class def, `false` otherwise.","summary":"

Returns true if current scope is a class def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"class_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ClassDef) || (!(!(check_outer_scopes && outer_scope.try(&.class_def?(check_outer_scopes: true)))))"}},{"html_id":"def?(*,check_outer_scopes=false)-instance-method","name":"def?","doc":"Returns `true` if current scope is a def, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::Def) || (!(!(check_outer_scopes && outer_scope.try(&.def?(check_outer_scopes: true)))))"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enum_def?(*,check_outer_scopes=false)-instance-method","name":"enum_def?","doc":"Returns `true` if current scope is a enum def, `false` otherwise.","summary":"

Returns true if current scope is a enum def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"enum_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::EnumDef) || (!(!(check_outer_scopes && outer_scope.try(&.enum_def?(check_outer_scopes: true)))))"}},{"html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns `true` if the *node* represents exactly\nthe same Crystal node as `@node`.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":218,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L218"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node == @node) && node.location) && (node.location == @node.location)"}},{"html_id":"find_variable(name:String)-instance-method","name":"find_variable","doc":"Returns variable by its name or `nil` if it does not exist.\n\n```\nscope = Scope.new(class_node, nil)\nscope.find_variable(\"foo\")\n```","summary":"

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

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/ast/scope.cr","line_number":98,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L98"},"def":{"name":"find_variable","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"variables.find() do |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"fun_def?(*,check_outer_scopes=false)-instance-method","name":"fun_def?","doc":"Returns `true` if current scope is a fun def, `false` otherwise.","summary":"

Returns true if current scope is a fun def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"fun_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::FunDef) || (!(!(check_outer_scopes && outer_scope.try(&.fun_def?(check_outer_scopes: true)))))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_macro?-instance-method","name":"in_macro?","doc":"Returns `true` if current scope sits inside a macro.","summary":"

Returns true if current scope sits inside a macro.

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":132,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L132"},"def":{"name":"in_macro?","visibility":"Public","body":"((node.is_a?(Crystal::Macro) || node.is_a?(Crystal::MacroIf)) || node.is_a?(Crystal::MacroFor)) || (!(!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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L32"},"def":{"name":"inner_scopes","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L23"},"def":{"name":"ivariables","visibility":"Public","body":"@ivariables"}},{"html_id":"lib_def?(*,check_outer_scopes=false)-instance-method","name":"lib_def?","doc":"Returns `true` if current scope is a lib def, `false` otherwise.","summary":"

Returns true if current scope is a lib def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"lib_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::LibDef) || (!(!(check_outer_scopes && outer_scope.try(&.lib_def?(check_outer_scopes: true)))))"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"module_def?(*,check_outer_scopes=false)-instance-method","name":"module_def?","doc":"Returns `true` if current scope is a module def, `false` otherwise.","summary":"

Returns true if current scope is a module def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L183"},"def":{"name":"module_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ModuleDef) || (!(!(check_outer_scopes && outer_scope.try(&.module_def?(check_outer_scopes: true)))))"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L35"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"outer_scope:Scope|Nil-instance-method","name":"outer_scope","doc":"Link to the outer scope","summary":"

Link to the outer scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L29"},"def":{"name":"outer_scope","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L17"},"def":{"name":"references","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,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","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":165,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L165"},"def":{"name":"references?","args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"variable.references.any? do |reference|\n (reference.scope == self) || (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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":127,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L127"},"def":{"name":"spawn_block?","visibility":"Public","body":"(node.as?(Crystal::Block)).try(&.call).try(&.name) == \"spawn\""}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":194,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L194"},"def":{"name":"top_level?","visibility":"Public","body":"outer_scope.nil?"}},{"html_id":"type_dec_variables:Array(Ameba::AST::TypeDecVariable)-instance-method","name":"type_dec_variables","doc":"Link to the type declaration variables used in current scope","summary":"

Link to the type declaration variables used in current scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L26"},"def":{"name":"type_dec_variables","visibility":"Public","body":"@type_dec_variables"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":153,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L153"},"def":{"name":"type_definition?","visibility":"Public","body":"(((((node.is_a?(Crystal::ClassDef) || node.is_a?(Crystal::ModuleDef)) || node.is_a?(Crystal::EnumDef)) || 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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L14"},"def":{"name":"variables","visibility":"Public","body":"@variables"}},{"html_id":"visibility-instance-method","name":"visibility","doc":"Returns visibility of the current scope (could be inherited from the outer scope).","summary":"

Returns visibility of the current scope (could be inherited from the outer scope).

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":179,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L179"},"def":{"name":"visibility","visibility":"Public","body":"@visibility || outer_scope.try(&.visibility)"}},{"html_id":"visibility=(visibility:Crystal::Visibility|Nil)-instance-method","name":"visibility=","doc":"Scope visibility level","summary":"

Scope visibility level

","abstract":false,"args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"args_string":"(visibility : Crystal::Visibility | Nil)","args_html":"(visibility : Crystal::Visibility | Nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L11"},"def":{"name":"visibility=","args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"visibility":"Public","body":"@visibility = visibility"}},{"html_id":"yields=(yields:Bool)-instance-method","name":"yields=","doc":"Whether the scope yields.","summary":"

Whether the scope yields.

","abstract":false,"args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"args_string":"(yields : Bool)","args_html":"(yields : Bool)","location":{"filename":"src/ameba/ast/scope.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L8"},"def":{"name":"yields=","args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"visibility":"Public","body":"@yields = yields"}},{"html_id":"yields?(check_inner_scopes=true)-instance-method","name":"yields?","doc":"Returns `true` if current scope (or any of inner scopes) yields,\n`false` otherwise.","summary":"

Returns true if current scope (or any of inner scopes) yields, false otherwise.

","abstract":false,"args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(check_inner_scopes = true)","args_html":"(check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/scope.cr#L174"},"def":{"name":"yields?","args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"@yields || (check_inner_scopes && inner_scopes.any?(&.yields?))"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{ClassDef, ModuleDef, EnumDef, LibDef, FunDef, TypeDef, TypeOf, CStructOrUnionDef, ProcLiteral, Block, Macro, MacroIf, MacroFor}","doc":"Non-exhaustive list of nodes to be visited by Ameba's rules.","summary":"

Non-exhaustive list of nodes to be visited by Ameba's rules.

"},{"id":"SPECIAL_NODE_NAMES","name":"SPECIAL_NODE_NAMES","value":"[\"super\", \"previous_def\"] of ::String"}],"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.

","constructors":[{"html_id":"new(rule,source,skip=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","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/scope_visitor.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/scope_visitor.cr#L31"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"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/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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","abstract":false,"location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is `Crystal::Expressions`,\nthen always traverse the children.","summary":"

If a top level node is Crystal::Expressions, then always traverse the children.

","abstract":false,"args":[{"name":"node","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L20"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L26"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"false"}}]},{"html_id":"ameba/Ameba/AST/TypeDecVariable","path":"Ameba/AST/TypeDecVariable.html","kind":"class","full_name":"Ameba::AST::TypeDecVariable","name":"TypeDecVariable","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/type_dec_variable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::TypeDeclaration)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"args_string":"(node : Crystal::TypeDeclaration)","args_html":"(node : Crystal::TypeDeclaration)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name-instance-method","name":"name","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L11"},"def":{"name":"name","visibility":"Public","body":"case var = @node.var\nwhen Crystal::Var, Crystal::InstanceVar, Crystal::ClassVar, Crystal::Global\n var.name\nelse\n raise(\"Unsupported var node type: #{var.class}\")\nend"}},{"html_id":"node:Crystal::TypeDeclaration-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L3"},"def":{"name":"node","return_type":"Crystal::TypeDeclaration","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"html_id":"ameba/Ameba/AST/Util","path":"Ameba/AST/Util.html","kind":"module","full_name":"Ameba::AST::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/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/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"}],"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.

","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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L180"},"def":{"name":"abort?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"abort\")) && node.args.size <= 2) && node.obj.nil?"}},{"html_id":"control_exp_code(node:Crystal::ControlExpression,code_lines)-instance-method","name":"control_exp_code","doc":"Returns the exp code of a control expression.\nWraps implicit tuple literal with curly brackets (e.g. multi-return).","summary":"

Returns the exp code of a control expression.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node : Crystal::ControlExpression, code_lines)","args_html":"(node : Crystal::ControlExpression, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L199"},"def":{"name":"control_exp_code","args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"visibility":"Public","body":"if exp = node.exp\nelse\n return\nend\nif exp_code = node_source(exp, code_lines)\nelse\n return\nend\nif exp.is_a?(Crystal::TupleLiteral) && (exp_code[0] != '{')\nelse\n return exp_code\nend\nif exp_start = exp.elements.first.location\nelse\n return\nend\nif exp_end = exp.end_location\nelse\n return\nend\n\"{#{source_between(exp_start, exp_end, code_lines)}}\"\n"}},{"html_id":"dynamic_literal?(node):Bool-instance-method","name":"dynamic_literal?","doc":"Returns `true` if current `node` is a dynamic literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L48"},"def":{"name":"dynamic_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && (!is_static)\n"}},{"html_id":"exit?(node)-instance-method","name":"exit?","doc":"Returns `true` if node represents `exit` method call.","summary":"

Returns true if node represents exit method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L174"},"def":{"name":"exit?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"exit\")) && node.args.size <= 1) && node.obj.nil?"}},{"html_id":"flow_command?(node,in_loop)-instance-method","name":"flow_command?","doc":"Returns `true` if node is a flow command, `false` otherwise.\nNode represents a flow command if it is a control expression,\nor special call node that interrupts execution (i.e. raise, exit, abort).","summary":"

Returns true if node is a flow command, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/util.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L102"},"def":{"name":"flow_command?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"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","external_name":"node","restriction":""},{"name":"in_loop","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":140,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L140"},"def":{"name":"flow_expression?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","default_value":"false","external_name":"in_loop","restriction":""}],"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):Bool-instance-method","name":"literal?","doc":"Returns `true` if current `node` is a literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L54"},"def":{"name":"literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, _ = literal_kind?(node)\nis_literal\n"}},{"html_id":"loop?(node)-instance-method","name":"loop?","doc":"Returns `true` if node represents a loop.","summary":"

Returns true if node represents a loop.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":186,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L186"},"def":{"name":"loop?","args":[{"name":"node","external_name":"node","restriction":""}],"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":"name_end_location(node)-instance-method","name":"name_end_location","doc":"Returns `nil` if *node* does not contain a name.\n\nNOTE: Use this instead of `Crystal::Call#name_end_location` to avoid an\n off-by-one error.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":242,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L242"},"def":{"name":"name_end_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = name_location(node)\nelse\n return\nend\nif (size = name_size(node)).zero?\n return\nend\nloc.adjust(column_number: size - 1)\n"}},{"html_id":"name_location(node)-instance-method","name":"name_location","doc":"Returns `nil` if *node* does not contain a name.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":210,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L210"},"def":{"name":"name_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = node.name_location\n return loc\nend\nif node.is_a?(Crystal::TypeDeclaration) || node.is_a?(Crystal::UninitializedVar)\n return node.var.location\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return\nend\nif name.is_a?(Crystal::ASTNode)\nelse\n return\nend\nname.location\n"}},{"html_id":"name_size(node)-instance-method","name":"name_size","doc":"Returns zero if *node* does not contain a name.","summary":"

Returns zero if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":224,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L224"},"def":{"name":"name_size","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if (size = node.name_size).zero?\nelse\n return size\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return 0\nend\ncase name\nwhen Crystal::ASTNode\n name.name_size\nwhen Crystal::Token::Kind\n name.to_s.size\nelse\n name.size\nend\n"}},{"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","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node, code_lines)","args_html":"(node, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L69"},"def":{"name":"node_source","args":[{"name":"node","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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":"path_named?(node,name):Bool-instance-method","name":"path_named?","doc":"Returns `true` if current `node` is a `Crystal::Path`\nmatching given *name*, `false` otherwise.","summary":"

Returns true if current node is a Crystal::Path matching given name, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"args_string":"(node, name) : Bool","args_html":"(node, name) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L61"},"def":{"name":"path_named?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"return_type":"Bool","visibility":"Public","body":"node.is_a?(Crystal::Path) && (name == (node.names.join(\"::\")))"}},{"html_id":"raise?(node)-instance-method","name":"raise?","doc":"Returns `true` if node represents `raise` method call.","summary":"

Returns true if node represents raise method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":168,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L168"},"def":{"name":"raise?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"raise\")) && (node.args.size == 1)) && node.obj.nil?"}},{"html_id":"source_between(loc,end_loc,code_lines):String|Nil-instance-method","name":"source_between","doc":"Returns the source code from *loc* to *end_loc* (inclusive).","summary":"

Returns the source code from loc to end_loc (inclusive).

","abstract":false,"args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String | Nil","args_html":"(loc, end_loc, code_lines) : String | Nil","location":{"filename":"src/ameba/ast/util.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L77"},"def":{"name":"source_between","args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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"}},{"html_id":"static_literal?(node):Bool-instance-method","name":"static_literal?","doc":"Returns `true` if current `node` is a static literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/util.cr#L42"},"def":{"name":"static_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && is_static\n"}}]},{"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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/AST/Reference","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference"}],"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 assignments.","summary":"

Represents the existence of the local variable.

","constructors":[{"html_id":"new(node:Crystal::Var,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::Var, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::Var, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L28"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L45"},"def":{"name":"assign","args":[{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"visibility":"Public","body":"assignments << (Assignment.new(node, self, scope))\nupdate_assign_reference!\n"}},{"html_id":"assign_before_reference:Crystal::ASTNode|Nil-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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L18"},"def":{"name":"assign_before_reference","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 assignments of this variable.","summary":"

List of the assignments of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","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","default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":114,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L114"},"def":{"name":"captured_by_block?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":163,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L163"},"def":{"name":"declared_before?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"var_location, node_location = location, node.location\nif var_location && node_location\nelse\n return\nend\n(var_location.line_number < node_location.line_number) || ((var_location.line_number == node_location.line_number) && var_location.column_number < node_location.column_number)\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L156"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(node.is_a?(Crystal::Var) && (node.name == @node.name)) && (node.location == @node.location)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":150,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L150"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","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","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","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":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L68"},"def":{"name":"reference","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"(Reference.new(node, scope)).tap do |reference|\n references << reference\n scope.references << reference\nend"}},{"html_id":"reference(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":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(scope : Scope)","args_html":"(scope : Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L76"},"def":{"name":"reference","args":[{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"reference(node, scope)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L87"},"def":{"name":"reference_assignments!","visibility":"Public","body":"consumed_branches = Set(Branch).new\nassignments.reverse_each do |assignment|\n if assignment.branch.in?(consumed_branches)\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, some_scope)\nvariable.referenced? # => true\n```","summary":"

Returns true if variable has any reference.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L58"},"def":{"name":"referenced?","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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","visibility":"Public","body":"@references"}},{"html_id":"scope:Scope-instance-method","name":"scope","doc":"Scope of this variable.","summary":"

Scope of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","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 $?.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L32"},"def":{"name":"special?","visibility":"Public","body":"@node.special_var?"}},{"html_id":"target_of?(assign)-instance-method","name":"target_of?","doc":"Returns `true` if the variable is a target (on the left) of the assignment,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"assign","external_name":"assign","restriction":""}],"args_string":"(assign)","args_html":"(assign)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":138,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L138"},"def":{"name":"target_of?","args":[{"name":"assign","external_name":"assign","restriction":""}],"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 |target|\n eql?(target)\n end\nwhen Crystal::UninitializedVar\n eql?(assign.var)\nelse\n false\nend"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/e6a5fa9/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` if not.","summary":"

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

","abstract":false,"args":[{"name":"scope","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":126,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ast/variabling/variable.cr#L126"},"def":{"name":"used_in_macro?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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"}}]}]},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L37"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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}"},{"id":"DEFAULT_GLOBS","name":"DEFAULT_GLOBS","value":"[\"**/*.cr\", \"!lib\"] of ::String"},{"id":"DEFAULT_PATH","name":"DEFAULT_PATH","value":"Path[Dir.current] / FILENAME"},{"id":"DEFAULT_PATHS","name":"DEFAULT_PATHS","value":"{Path[\"~\"] / FILENAME, Path[XDG_CONFIG_HOME] / \"ameba/config.yml\"}"},{"id":"FILENAME","name":"FILENAME","value":"\".ameba.yml\""},{"id":"XDG_CONFIG_HOME","name":"XDG_CONFIG_HOME","value":"ENV.fetch(\"XDG_CONFIG_HOME\", \"~/.config\")"}],"included_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"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 located in a current\nworking directory.\n\nIf it cannot be found until reaching the root directory, then it will be\nsearched for in the user’s global config locations, which consists of a\ndotfile or a config file inside the XDG Base Directory specification.\n\n- `~/.ameba.yml`\n- `$XDG_CONFIG_HOME/ameba/config.yml` (expands to `~/.config/ameba/config.yml`\n if `$XDG_CONFIG_HOME` is not set)\n\nIf both files exist, the dotfile will be selected.\n\nAs an example, if Ameba is invoked from inside `/path/to/project/lib/utils`,\nthen it will use the config as specified inside the first of the following files:\n\n- `/path/to/project/lib/utils/.ameba.yml`\n- `/path/to/project/lib/.ameba.yml`\n- `/path/to/project/.ameba.yml`\n- `/path/to/.ameba.yml`\n- `/path/.ameba.yml`\n- `/.ameba.yml`\n- `~/.ameba.yml`\n- `~/.config/ameba/config.yml`","summary":"

A configuration entry for Ameba::Runner.

","class_methods":[{"html_id":"formatter_names-class-method","name":"formatter_names","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":145,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L145"},"def":{"name":"formatter_names","visibility":"Public","body":"AVAILABLE_FORMATTERS.keys.join('|')"}},{"html_id":"load(path=nil,colors=true,skip_reading_config=false)-class-method","name":"load","doc":"Loads YAML configuration file by `path`.\n\n```\nconfig = Ameba::Config.load\n```","summary":"

Loads YAML configuration file by path.

","abstract":false,"args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"args_string":"(path = nil, colors = true, skip_reading_config = false)","args_html":"(path = nil, colors = true, skip_reading_config = false)","location":{"filename":"src/ameba/config.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L110"},"def":{"name":"load","args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"visibility":"Public","body":"begin\n Colorize.enabled = colors\n content = if skip_reading_config\n \"{}\"\n else\n (read_config(path)) || \"{}\"\n end\n Config.new(YAML.parse(content))\nrescue e\n raise(\"Unable to load config file: #{e.message}\")\nend"}}],"instance_methods":[{"html_id":"autocorrect=(autocorrect:Bool)-instance-method","name":"autocorrect=","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"args_string":"(autocorrect : Bool)","args_html":"(autocorrect : Bool)","location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L87"},"def":{"name":"autocorrect=","args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"visibility":"Public","body":"@autocorrect = autocorrect"}},{"html_id":"autocorrect?:Bool-instance-method","name":"autocorrect?","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L87"},"def":{"name":"autocorrect?","visibility":"Public","body":"@autocorrect"}},{"html_id":"excluded:Array(String)-instance-method","name":"excluded","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L84"},"def":{"name":"excluded","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","external_name":"excluded","restriction":"Array(String)"}],"args_string":"(excluded : Array(String))","args_html":"(excluded : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L84"},"def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String)"}],"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L171"},"def":{"name":"formatter","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","external_name":"name","restriction":"String | Symbol"}],"args_string":"(name : String | Symbol)","args_html":"(name : String | Symbol)","location":{"filename":"src/ameba/config.cr","line_number":181,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L181"},"def":{"name":"formatter=","args":[{"name":"name","external_name":"name","restriction":"String | Symbol"}],"visibility":"Public","body":"if formatter = AVAILABLE_FORMATTERS[name]?\nelse\n raise(\"Unknown formatter `#{name}`. Use one of #{Config.formatter_names}.\")\nend\n@formatter = formatter.new\n"}},{"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L171"},"def":{"name":"formatter=","args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L75"},"def":{"name":"globs","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","external_name":"globs","restriction":"Array(String)"}],"args_string":"(globs : Array(String))","args_html":"(globs : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L75"},"def":{"name":"globs=","args":[{"name":"globs","external_name":"globs","restriction":"Array(String)"}],"visibility":"Public","body":"@globs = globs"}},{"html_id":"rules:Array(Rule::Base)-instance-method","name":"rules","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L63"},"def":{"name":"rules","return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L64"},"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L64"},"def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L158"},"def":{"name":"sources","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","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":194,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L194"},"def":{"name":"update_rule","args":[{"name":"name","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/config.cr#L215"},"def":{"name":"update_rules","args":[{"name":"names","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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)"}}]},{"html_id":"ameba/Ameba/Ext","path":"Ameba/Ext.html","kind":"module","full_name":"Ameba::Ext","name":"Ext","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Ext/Location","path":"Ameba/Ext/Location.html","kind":"module","full_name":"Ameba::Ext::Location","name":"Location","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"ameba/Crystal/Location","kind":"class","full_name":"Crystal::Location","name":"Location"}],"namespace":{"html_id":"ameba/Ameba/Ext","kind":"module","full_name":"Ameba::Ext","name":"Ext"},"doc":"Extensions to Crystal::Location","summary":"

Extensions to Crystal::Location

","instance_methods":[{"html_id":"adjust(line_number=0,column_number=0):self-instance-method","name":"adjust","doc":"Returns the same location as this location but with the line and/or column number(s) adjusted\nby the given amount(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) adjusted by the given amount(s).

","abstract":false,"args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"args_string":"(line_number = 0, column_number = 0) : self","args_html":"(line_number = 0, column_number = 0) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L11"},"def":{"name":"adjust","args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, @line_number + line_number, @column_number + column_number)"}},{"html_id":"seek(offset:self):self-instance-method","name":"seek","doc":"Seeks to a given *offset* relative to `self`.","summary":"

Seeks to a given offset relative to self.

","abstract":false,"args":[{"name":"offset","external_name":"offset","restriction":"self"}],"args_string":"(offset : self) : self","args_html":"(offset : self) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L16"},"def":{"name":"seek","args":[{"name":"offset","external_name":"offset","restriction":"self"}],"return_type":"self","visibility":"Public","body":"if (offset.filename.as?(String)).presence && (@filename != offset.filename)\n raise(ArgumentError.new(\"Mismatching filenames:\\n #{@filename}\\n #{offset.filename}\"))\nend\nif offset.line_number == 1\n self.class.new(@filename, @line_number, (@column_number + offset.column_number) - 1)\nelse\n self.class.new(@filename, (@line_number + offset.line_number) - 1, offset.column_number)\nend\n"}},{"html_id":"with(line_number=@line_number,column_number=@column_number):self-instance-method","name":"with","doc":"Returns the same location as this location but with the line and/or column number(s) changed\nto the given value(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) changed to the given value(s).

","abstract":false,"args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"args_string":"(line_number = @line_number, column_number = @column_number) : self","args_html":"(line_number = @line_number, column_number = @column_number) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/ext/location.cr#L5"},"def":{"name":"with","args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, line_number, column_number)"}}]}]},{"html_id":"ameba/Ameba/Formatter","path":"Ameba/Formatter.html","kind":"module","full_name":"Ameba::Formatter","name":"Formatter","abstract":false,"locations":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/base_formatter.cr#L13"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","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","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L30"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/base_formatter.cr#L10"},"def":{"name":"output","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","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L26"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":""}},{"html_id":"source_started(source:Source)-instance-method","name":"source_started","doc":"Callback that indicates when source inspection is started.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is started.

","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L22"},"def":{"name":"source_started","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/e6a5fa9/src/ameba/formatter/base_formatter.cr#L18"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":""}}]},{"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/e6a5fa9/src/ameba/formatter/disabled_formatter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/e6a5fa9/src/ameba/formatter/disabled_formatter.cr#L4"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"output << \"Disabled rules using inline directives:\\n\\n\"\nsources.each do |source|\n source.issues.select(&.disabled?).each do |issue|\n if loc = issue.location\n else\n next\n end\n output << (\"#{source.path}:#{loc.line_number}\".colorize(:cyan))\n output << \" #{issue.rule.name}\\n\"\n end\nend\n"}}]},{"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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"subclasses":[{"html_id":"ameba/Ameba/Formatter/TODOFormatter","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter"}],"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.

","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","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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L27"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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.print(location.colorize(:cyan))\n if issue.correctable?\n if config[:autocorrect]?\n output.print(\" [Corrected]\".colorize(:green))\n else\n output.print(\" [Correctable]\".colorize(:yellow))\n end\n end\n output.puts\n output.puts((\"[%s] %s: %s\" % {issue.rule.severity.symbol, issue.rule.name, issue.message}).colorize(issue.rule.severity.color))\n if show_affected_code && (code = affected_code(issue))\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","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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L21"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/e6a5fa9/src/ameba/formatter/dot_formatter.cr#L13"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@started_at = Time.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\n"}}]},{"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/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(output:IO,location)-class-method","name":"new","doc":"Creates a new instance of `ExplainFormatter`.\n\nAccepts *output* which indicates the io where the explanation will be written to.\nSecond argument is *location* which indicates the location to explain.\n\n```\nExplainFormatter.new output, {\n file: path,\n line: line_number,\n column: column_number,\n}\n```","summary":"

Creates a new instance of ExplainFormatter.

","abstract":false,"args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"args_string":"(output : IO, location)","args_html":"(output : IO, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L24"},"def":{"name":"new","args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"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 explanations at the *@location*.","summary":"

Reports the explanations at the @location.

","abstract":false,"args":[{"name":"sources","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L33"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L10"},"def":{"name":"location","return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/explain_formatter.cr#L9"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"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/e6a5fa9/src/ameba/formatter/flycheck_formatter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"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","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/e6a5fa9/src/ameba/formatter/flycheck_formatter.cr#L5"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n if loc = issue.location\n else\n next\n end\n @mutex.synchronize do\n output.printf(\"%s:%d:%d: %s: [%s] %s\\n\", source.path, loc.line_number, loc.column_number, issue.rule.severity.symbol, issue.rule.name, issue.message.gsub('\\n', \" \"))\n end\nend"}}]},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L65"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

A formatter that produces the result in a json format.

","constructors":[{"html_id":"new(output=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","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":66,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L66"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":94,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L94"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L74"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"json_source = AsJSON::Source.new(source.path)\nsource.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n json_source.issues << (AsJSON::Issue.new(issue.rule.name, issue.rule.severity.to_s, issue.location, issue.end_location, issue.message))\n __temp_54 = @result.summary\n __temp_54.issues_count = __temp_54.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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/json_formatter.cr#L70"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@result.summary.target_sources_count = sources.size"}}]},{"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/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(output=STDOUT,config_path:Path=Config::DEFAULT_PATH)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"args_string":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","args_html":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L6"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output, config_path)\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","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/e6a5fa9/src/ameba/formatter/todo_formatter.cr#L9"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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\n(generate_todo_config(issues)).tap do |file|\n @output.puts(\"Created #{file.path}\")\nend\n"}}]},{"html_id":"ameba/Ameba/Formatter/Util","path":"Ameba/Formatter/Util.html","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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"},"instance_methods":[{"html_id":"affected_code(issue:Issue,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L45"},"def":{"name":"affected_code","args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"if location = issue.location\nelse\n return\nend\naffected_code(issue.code, location, issue.end_location, context_lines, max_length, ellipsis, prompt)\n"}},{"html_id":"affected_code(code,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L51"},"def":{"name":"affected_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"lines = code.split('\\n')\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","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","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":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L19"},"def":{"name":"context","args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","default_value":"true","external_name":"remove_empty","restriction":""}],"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|Nil):String|Nil-instance-method","name":"deansify","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String | Nil) : String | Nil","args_html":"(message : String | Nil) : String | Nil","location":{"filename":"src/ameba/formatter/util.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L5"},"def":{"name":"deansify","args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"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","abstract":false,"args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/formatter/util.cr#L9"},"def":{"name":"trim","args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"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"}}]}]},{"html_id":"ameba/Ameba/GlobUtils","path":"Ameba/GlobUtils.html","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils","abstract":false,"locations":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/glob_utils.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/e6a5fa9/src/ameba/glob_utils.cr#L22"},"def":{"name":"expand","args":[{"name":"globs","external_name":"globs","restriction":""}],"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","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/e6a5fa9/src/ameba/glob_utils.cr#L10"},"def":{"name":"find_files_by_globs","args":[{"name":"globs","external_name":"globs","restriction":""}],"visibility":"Public","body":"rejected = rejected_globs(globs)\nselected = globs - rejected\n(expand(selected)) - (expand(rejected.map!(&.[](1..-1))))\n"}}]},{"html_id":"ameba/Ameba/InlineComments","path":"Ameba/InlineComments.html","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments","abstract":false,"locations":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COMMENT_DIRECTIVE_REGEX","name":"COMMENT_DIRECTIVE_REGEX","value":"/# ameba:(?\\w+) (?\\w+(?:\\/\\w+)?(?:,? \\w+(?:\\/\\w+)?)*)/"}],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes inline comments parsing and processing logic.","summary":"

A module that utilizes inline comments parsing and processing logic.

","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.

","abstract":false,"args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"args_string":"(line_number : Int32)","args_html":"(line_number : Int32)","location":{"filename":"src/ameba/inline_comments.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L78"},"def":{"name":"comment?","args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"visibility":"Public","body":"if line = lines[line_number]?\nelse\n return\nend\ncomment?(line)\n"}},{"html_id":"location_disabled?(location:Crystal::Location|Nil,rule)-instance-method","name":"location_disabled?","doc":"Returns `true` if current location is disabled for a particular rule,\n`false` otherwise.\n\nLocation is disabled in two cases:\n 1. The line of the location ends with a comment directive.\n 2. The line above the location is a comment directive.\n\nFor example, here are two examples of disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\nTime.epoch(1483859302)\n\nTime.epoch(1483859302) # ameba:disable Style/LargeNumbers\n```\n\nBut here are examples which are not considered as disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\n#\nTime.epoch(1483859302)\n\nif use_epoch? # ameba:disable Style/LargeNumbers\n Time.epoch(1483859302)\nend\n```","summary":"

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

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(location : Crystal::Location | Nil, rule)","args_html":"(location : Crystal::Location | Nil, rule)","location":{"filename":"src/ameba/inline_comments.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L40"},"def":{"name":"location_disabled?","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"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","external_name":"line","restriction":""}],"args_string":"(line)","args_html":"(line)","location":{"filename":"src/ameba/inline_comments.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L68"},"def":{"name":"parse_inline_directive","args":[{"name":"line","external_name":"line","restriction":""}],"visibility":"Public","body":"if directive = COMMENT_DIRECTIVE_REGEX.match(line)\nelse\n return\nend\nif commented_out?(line.gsub(directive[0], \"\"))\n return\nend\n{action: directive[\"action\"], rules: directive[\"rules\"].split(/[\\s,]/, remove_empty: true)}\n"}}],"types":[{"html_id":"ameba/Ameba/InlineComments/Action","path":"Ameba/InlineComments/Action.html","kind":"enum","full_name":"Ameba::InlineComments::Action","name":"Action","abstract":false,"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":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L8"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Disable","name":"Disable","value":"0"},{"id":"Enable","name":"Enable","value":"1"}],"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

","instance_methods":[{"html_id":"disable?-instance-method","name":"disable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L9"},"def":{"name":"disable?","visibility":"Public","body":"self == Disable"}},{"html_id":"enable?-instance-method","name":"enable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/inline_comments.cr#L10"},"def":{"name":"enable?","visibility":"Public","body":"self == Enable"}}]}]},{"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/e6a5fa9/src/ameba/issue.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(code:String,rule:Ameba::Rule::Base,location:Nil|Crystal::Location,end_location:Nil|Crystal::Location,message:String,status:Status|Nil=nil,block:Source::Corrector->|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","args_html":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","location":{"filename":"src/ameba/issue.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L30"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, rule, location, end_location, message, status, block)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","doc":"The source code that triggered this issue.","summary":"

The source code that triggered this issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L10"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct(corrector)-instance-method","name":"correct","abstract":false,"args":[{"name":"corrector","external_name":"corrector","restriction":""}],"args_string":"(corrector)","args_html":"(corrector)","location":{"filename":"src/ameba/issue.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L42"},"def":{"name":"correct","args":[{"name":"corrector","external_name":"corrector","restriction":""}],"visibility":"Public","body":"@block.try(&.call(corrector))"}},{"html_id":"correctable?-instance-method","name":"correctable?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L38"},"def":{"name":"correctable?","visibility":"Public","body":"!@block.nil?"}},{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location|Nil-instance-method","name":"end_location","doc":"End location of the issue.","summary":"

End location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L19"},"def":{"name":"end_location","return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@end_location"}},{"html_id":"location:Crystal::Location|Nil-instance-method","name":"location","doc":"Location of the issue.","summary":"

Location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L16"},"def":{"name":"location","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,"location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L22"},"def":{"name":"message","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,"location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L13"},"def":{"name":"rule","return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"

Issue status.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L25"},"def":{"name":"status","return_type":"Status","visibility":"Public","body":"@status"}},{"html_id":"syntax?-instance-method","name":"syntax?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L34"},"def":{"name":"syntax?","visibility":"Public","body":"rule.is_a?(Rule::Lint::Syntax)"}}],"types":[{"html_id":"ameba/Ameba/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","abstract":false,"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/e6a5fa9/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0"},{"id":"Disabled","name":"Disabled","value":"1"}],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"instance_methods":[{"html_id":"disabled?-instance-method","name":"disabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","visibility":"Public","body":"self == Enabled"}}]}]},{"html_id":"ameba/Ameba/Presenter","path":"Ameba/Presenter.html","kind":"module","full_name":"Ameba::Presenter","name":"Presenter","abstract":false,"locations":[{"filename":"src/ameba/presenter/base_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_collection_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_presenter.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","path":"Ameba/Presenter/BasePresenter.html","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter","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/presenter/base_presenter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter"},{"html_id":"ameba/Ameba/Presenter/RulePresenter","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter"}],"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L9"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":"TODO: allow other IOs","summary":"

TODO allow other IOs

","abstract":false,"location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/base_presenter.cr#L7"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","path":"Ameba/Presenter/RuleCollectionPresenter.html","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_collection_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_collection_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rules)-instance-method","name":"run","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":""}],"args_string":"(rules)","args_html":"(rules)","location":{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_collection_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rules","external_name":"rules","restriction":""}],"visibility":"Public","body":"rules = rules.to_h do |rule|\n name = rule.name.split('/')\n name = \"%s/%s\" % {(name[0...-1].join('/')).colorize(:light_gray), name.last.colorize(:white)}\n {name, rule}\nend\nlongest_name = rules.max_of() do |__arg0|\n __arg0.first.size\nend\nrules.group_by() do |__arg1|\n __arg1.last.group\nend.each do |group, group_rules|\n output.puts(\"— %s\" % (group.colorize(:light_blue)).underline)\n output.puts\n group_rules.each do |name, rule|\n output.puts(\" %s [%s] %s %s\" % {rule.enabled? ? ENABLED_MARK : DISABLED_MARK, rule.severity.symbol.to_s.colorize(:green), name.ljust(longest_name), rule.description.colorize(:dark_gray)})\n end\n output.puts\nend\noutput.puts(\"Total rules: %s / %s enabled\" % {rules.size.to_s.colorize(:light_blue), rules.count() do |__arg2|\n __arg2.last.enabled?\nend.to_s.colorize(:light_blue)})\n"}}]},{"html_id":"ameba/Ameba/Presenter/RulePresenter","path":"Ameba/Presenter/RulePresenter.html","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rule)-instance-method","name":"run","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(rule)","args_html":"(rule)","location":{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/presenter/rule_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rule","external_name":"rule","restriction":""}],"visibility":"Public","body":"output.puts\noutput_title(\"Rule info\")\noutput_paragraph(\"%s of a %s severity [enabled: %s]\" % {rule.name.colorize(:magenta), rule.severity.to_s.colorize(rule.severity.color), rule.enabled? ? ENABLED_MARK : DISABLED_MARK})\nif rule_description = colorize_code_fences(rule.description)\n output_paragraph(rule_description)\nend\nif rule_doc = colorize_code_fences(rule.class.parsed_doc)\n output_title(\"Detailed description\")\n output_paragraph(rule_doc)\nend\n"}}]}]},{"html_id":"ameba/Ameba/Reportable","path":"Ameba/Reportable.html","kind":"module","full_name":"Ameba::Reportable","name":"Reportable","abstract":false,"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"locations":[{"filename":"src/ameba/reportable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","instance_methods":[{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L12"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(code, rule, location, end_location, message, status, block)).tap do |issue|\n issues << issue\nend\n"}},{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L27"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L53"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L63"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L76"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"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, block)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=nil,*,prefer_name_location=false):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L37"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":5,"return_type":"Issue","visibility":"Public","body":"if prefer_name_location\n location = name_location(node)\nend\nlocation || (location = node.location)\nif prefer_name_location\n end_location = name_end_location(node)\nend\nend_location || (end_location = node.end_location)\nadd_issue(rule, location, end_location, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L71"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L58"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","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 = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L91"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,*,prefer_name_location=false,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L48"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":4,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node, message, status, block, prefer_name_location: prefer_name_location)"}},{"html_id":"issues-instance-method","name":"issues","doc":"List of reported issues.","summary":"

List of reported issues.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L9"},"def":{"name":"issues","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.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":101,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/reportable.cr#L101"},"def":{"name":"valid?","visibility":"Public","body":"issues.none?(&.enabled?)"}}]},{"html_id":"ameba/Ameba/Rule","path":"Ameba/Rule.html","kind":"module","full_name":"Ameba::Rule","name":"Rule","abstract":false,"locations":[{"filename":"src/ameba/rule/base.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECIAL","name":"SPECIAL","value":"{Lint::Syntax.rule_name, Lint::UnneededDisableDirective.rule_name}","doc":"List of names of the special rules, which\nbehave differently than usual rules.","summary":"

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

"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L174"},"def":{"name":"rules","visibility":"Public","body":"Base.inherited_rules"}}],"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/e6a5fa9/src/ameba/rule/base.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"GROUP_SEVERITY","name":"GROUP_SEVERITY","value":"{Documentation: Ameba::Severity::Warning, Lint: Ameba::Severity::Warning, Metrics: Ameba::Severity::Warning, Performance: Ameba::Severity::Warning}"}],"included_modules":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation"},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition"},{"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/DebugCalls","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls"},{"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/Formatting","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument"},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"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/SpecFilename","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename"},{"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/Typos","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos"},{"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/UnusedBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument"},{"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/Naming/AccessorMethodName","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName"},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers"},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Naming/Filename","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename"},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","kind":"class","full_name":"Ameba::Rule::Naming::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","kind":"class","full_name":"Ameba::Rule::Naming::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName"},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","kind":"class","full_name":"Ameba::Rule::Naming::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition"},{"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/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"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"}],"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":"default_severity:Ameba::Severity-class-method","name":"default_severity","abstract":false,"def":{"name":"default_severity","return_type":"Ameba::Severity","visibility":"Public","body":"if (value = @@default_severity).nil?\n @@default_severity = (GROUP_SEVERITY[group_name]? || Ameba::Severity::Convention)\nelse\n value\nend"}}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/rule/base.cr","line_number":108,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L108"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"name == other.try(&.name)"}},{"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L53"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.tap do\n test(source)\nend"}},{"html_id":"excluded?(source)-instance-method","name":"excluded?","doc":"Checks whether the source is excluded from this rule.\nIt searches for a path in `excluded` property which matches\nthe one of the given source.\n\n```\nmy_rule.excluded?(source) # => true or false\n```","summary":"

Checks whether the source is excluded from this rule.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/base.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L91"},"def":{"name":"excluded?","args":[{"name":"source","external_name":"source","restriction":""}],"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L80"},"def":{"name":"group","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.

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L112"},"def":{"name":"hash","visibility":"Public","body":"name.hash"}},{"html_id":"name-instance-method","name":"name","doc":"Returns a name of this rule, which is basically a class name.\n\n```\nclass MyRule < Ameba::Rule::Base\n def test(source)\n end\nend\n\nMyRule.new.name # => \"MyRule\"\n```","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L67"},"def":{"name":"name","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,"location":{"filename":"src/ameba/rule/base.cr","line_number":104,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L104"},"def":{"name":"special?","visibility":"Public","body":"name.in?(SPECIAL)"}},{"html_id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","name":"test","doc":"NOTE: Can't be abstract","summary":"

NOTE Can't be abstract

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","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":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","external_name":"opts","restriction":""}],"splat_index":2,"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source)"}}],"macros":[{"html_id":"issue_for(*args,**kwargs,&block)-macro","name":"issue_for","doc":"Adds an issue to the *source*","summary":"

Adds an issue to the source

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **kwargs, &block)","args_html":"(*args, **kwargs, &block)","location":{"filename":"src/ameba/rule/base.cr","line_number":117,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/base.cr#L117"},"def":{"name":"issue_for","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"kwargs","external_name":"kwargs","restriction":""},"splat_index":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" source.add_issue(self, \n{{ args.splat }}\n, \n{{ kwargs.double_splat }}\n) \n{{ block }}\n\n \n"}}]},{"html_id":"ameba/Ameba/Rule/Documentation","path":"Ameba/Rule/Documentation.html","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation","abstract":false,"locations":[{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L1"},{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","path":"Ameba/Rule/Documentation/Documentation.html","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation","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/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L17"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MACRO_HOOK_NAMES","name":"MACRO_HOOK_NAMES","value":"[\"inherited\", \"included\", \"extended\", \"method_missing\", \"method_added\", \"finished\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Missing documentation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L17"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_classes=(ignore_classes:Bool)-instance-method","name":"ignore_classes=","abstract":false,"args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"args_string":"(ignore_classes : Bool)","args_html":"(ignore_classes : Bool)","def":{"name":"ignore_classes=","args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"visibility":"Public","body":"@ignore_classes = ignore_classes"}},{"html_id":"ignore_classes?:Bool-instance-method","name":"ignore_classes?","abstract":false,"def":{"name":"ignore_classes?","return_type":"Bool","visibility":"Public","body":"@ignore_classes"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_enums=(ignore_enums:Bool)-instance-method","name":"ignore_enums=","abstract":false,"args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"args_string":"(ignore_enums : Bool)","args_html":"(ignore_enums : Bool)","def":{"name":"ignore_enums=","args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"visibility":"Public","body":"@ignore_enums = ignore_enums"}},{"html_id":"ignore_enums?:Bool-instance-method","name":"ignore_enums?","abstract":false,"def":{"name":"ignore_enums?","return_type":"Bool","visibility":"Public","body":"@ignore_enums"}},{"html_id":"ignore_macro_hooks=(ignore_macro_hooks:Bool)-instance-method","name":"ignore_macro_hooks=","abstract":false,"args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"args_string":"(ignore_macro_hooks : Bool)","args_html":"(ignore_macro_hooks : Bool)","def":{"name":"ignore_macro_hooks=","args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macro_hooks = ignore_macro_hooks"}},{"html_id":"ignore_macro_hooks?:Bool-instance-method","name":"ignore_macro_hooks?","abstract":false,"def":{"name":"ignore_macro_hooks?","return_type":"Bool","visibility":"Public","body":"@ignore_macro_hooks"}},{"html_id":"ignore_macros=(ignore_macros:Bool)-instance-method","name":"ignore_macros=","abstract":false,"args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"args_string":"(ignore_macros : Bool)","args_html":"(ignore_macros : Bool)","def":{"name":"ignore_macros=","args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macros = ignore_macros"}},{"html_id":"ignore_macros?:Bool-instance-method","name":"ignore_macros?","abstract":false,"def":{"name":"ignore_macros?","return_type":"Bool","visibility":"Public","body":"@ignore_macros"}},{"html_id":"ignore_modules=(ignore_modules:Bool)-instance-method","name":"ignore_modules=","abstract":false,"args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"args_string":"(ignore_modules : Bool)","args_html":"(ignore_modules : Bool)","def":{"name":"ignore_modules=","args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"visibility":"Public","body":"@ignore_modules = ignore_modules"}},{"html_id":"ignore_modules?:Bool-instance-method","name":"ignore_modules?","abstract":false,"def":{"name":"ignore_modules?","return_type":"Bool","visibility":"Public","body":"@ignore_modules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ClassDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ClassDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_classes? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::ModuleDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_modules? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::EnumDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::EnumDef, scope : AST::Scope)","args_html":"(source, node : Crystal::EnumDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_enums? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/documentation/documentation.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_defs? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Macro,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Macro, scope : AST::Scope)","args_html":"(source, node : Crystal::Macro, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if ignore_macro_hooks? && (node.name.in?(MACRO_HOOK_NAMES))\n return\nend\nignore_macros? || (check_missing_doc(source, node, scope))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","path":"Ameba/Rule/Documentation/DocumentationAdmonition.html","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition","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/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Found a %s admonition in a comment\""},{"id":"MSG_ERR","name":"MSG_ERR","value":"\"%s admonition error: %s\""},{"id":"MSG_LATE","name":"MSG_LATE","value":"\"Found a %s admonition in a comment (%s)\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"admonitions:Array(String)-instance-method","name":"admonitions","abstract":false,"def":{"name":"admonitions","visibility":"Public","body":"@admonitions"}},{"html_id":"admonitions=(admonitions:Array(String))-instance-method","name":"admonitions=","abstract":false,"args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"args_string":"(admonitions : Array(String))","args_html":"(admonitions : Array(String))","def":{"name":"admonitions=","args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"visibility":"Public","body":"@admonitions = admonitions"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/documentation/documentation_admonition.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type.comment?\n else\n next\n end\n if doc = token.value.to_s\n else\n next\n end\n pattern = /^#\\s*(?#{Regex.union(admonitions)})(?:\\((?.+?)\\))?(?:\\W+|$)/m\n matches = doc.scan(pattern)\n matches.each do |match|\n admonition = match[\"admonition\"]\n begin\n case expr = match[\"context\"]?.presence\n when /\\A\\d{4}-\\d{2}-\\d{2}\\Z/\n date = Time.parse(expr.not_nil!, \"%F\", location)\n issue_for_date(source, token, admonition, date)\n when /\\A\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}(:\\d{2})?\\Z/\n date = Time.parse(expr.not_nil!, \"%F #{$~[1]?.presence ? \"%T\" : \"%R\"}\", location)\n issue_for_date(source, token, admonition, date)\n else\n issue_for(token, MSG % admonition)\n end\n rescue ex\n issue_for(token, MSG_ERR % {admonition, \"#{ex}: #{expr.inspect}\"})\n end\n end\nend"}},{"html_id":"timezone:String-instance-method","name":"timezone","abstract":false,"def":{"name":"timezone","return_type":"String","visibility":"Public","body":"@timezone"}},{"html_id":"timezone=(timezone:String)-instance-method","name":"timezone=","abstract":false,"args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"args_string":"(timezone : String)","args_html":"(timezone : String)","def":{"name":"timezone=","args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"visibility":"Public","body":"@timezone = timezone"}}]}]},{"html_id":"ameba/Ameba/Rule/Layout","path":"Ameba/Rule/Layout.html","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout","abstract":false,"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/e6a5fa9/src/ameba/rule/layout/line_length.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Line too long\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/layout/line_length.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Int32-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"Int32","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Int32)-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"args_string":"(max_length : Int32)","args_html":"(max_length : Int32)","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/layout/line_length.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line.size > max_length\n issue_for({index + 1, max_length + 1}, MSG)\n end\nend"}}]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","path":"Ameba/Rule/Layout/TrailingBlankLines.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines","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_blank_lines.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/layout/trailing_blank_lines.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Excessive trailing newline detected\""},{"id":"MSG_FINAL_NEWLINE","name":"MSG_FINAL_NEWLINE","value":"\"Trailing newline missing\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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.zero? || ((source_lines.last(2)).join.presence && last_line_empty)\n return\nend\nif last_line_empty\n issue_for({source_lines_size, 1}, MSG)\nelse\n issue_for({source_lines_size, 1}, MSG_FINAL_NEWLINE) do |corrector|\n corrector.insert_before({source_lines_size + 1, 1}, '\\n')\n end\nend\n"}}]},{"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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Trailing whitespace detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if ws_index = line =~ (/\\s+$/)\n else\n next\n end\n location = {index + 1, ws_index + 1}\n end_location = {index + 1, line.size}\n issue_for(location, end_location, MSG) do |corrector|\n corrector.remove(location, end_location)\n end\nend"}}]}]},{"html_id":"ameba/Ameba/Rule/Lint","path":"Ameba/Rule/Lint.html","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint","abstract":false,"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/formatting.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L3"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L1"},{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L3"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/typos.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/ambiguous_assignment.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\": \"-=\", \"=+\": \"+=\", \"=!\": \"!=\"}"},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\""}],"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"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"

This rule checks for mistyped shorthand assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/ambiguous_assignment.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/ambiguous_assignment.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"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 suggestion = MISTAKES[op_text]?\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % suggestion)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/bad_directive.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALL_GROUP_NAMES","name":"ALL_GROUP_NAMES","value":"Rule.rules.map(&.group_name).uniq!"},{"id":"ALL_RULE_NAMES","name":"ALL_RULE_NAMES","value":"Rule.rules.map(&.rule_name)"},{"id":"AVAILABLE_ACTIONS","name":"AVAILABLE_ACTIONS","value":"InlineComments::Action.names.map(&.downcase)"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/bad_directive.cr#L20"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/bad_directive.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison to a boolean is pointless\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/comparison_to_boolean.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif node.args.size == 1\nelse\n return\nend\narg, obj = node.args.first, node.obj\ncase\nwhen arg.is_a?(Crystal::BoolLiteral)\n bool, exp = arg, obj\nwhen obj.is_a?(Crystal::BoolLiteral)\n bool, exp = obj, arg\nend\nif bool && exp\nelse\n return\nend\nif exp_code = node_source(exp, source.lines)\nelse\n return\nend\nnot = case node.name\nwhen \"==\", \"===\"\n !bool.value\nwhen \"!=\"\n bool.value\nend\nif not\n exp_code = \"!#{exp_code}\"\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/DebugCalls","path":"Ameba/Rule/Lint/DebugCalls.html","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls","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/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possibly forgotten debug-related `%s` call detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows calls to debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"method_names:Array(String)-instance-method","name":"method_names","abstract":false,"def":{"name":"method_names","visibility":"Public","body":"@method_names"}},{"html_id":"method_names=(method_names:Array(String))-instance-method","name":"method_names=","abstract":false,"args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"args_string":"(method_names : Array(String))","args_html":"(method_names : Array(String))","def":{"name":"method_names=","args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@method_names = method_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/debug_calls.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(method_names)) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG % node.name)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/debugger_statement.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possible forgotten debugger statement detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/debugger_statement.cr#L13"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/debugger_statement.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name == \"debugger\") && node.args.empty?) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require of `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/duplicated_require.cr#L16"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/duplicated_require.cr#L23"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if node.string.in?(processed_require_strings)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}]},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_ensure.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty `ensure` block detected\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_ensure.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_ensure.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node_ensure = node.ensure\nif node_ensure.nil? || (!node_ensure.nop?)\n return\nend\nissue_for(node.ensure_location, node.end_location, MSG)\n"}}]},{"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/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/e6a5fa9/src/ameba/rule/lint/empty_expression.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid empty expressions\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/empty_expression.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Expressions)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_expression.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if (node.expressions.size == 1) && node.expressions.first.nop?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty loop detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if loop?(node)\n check_node(source, node, node.block)\nend"}},{"html_id":"test(source,node:Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/empty_loop.cr#L53"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Formatting","path":"Ameba/Rule/Lint/Formatting.html","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting","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/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use built-in formatter to format this source\""},{"id":"MSG_ERROR","name":"MSG_ERROR","value":"\"Error while formatting: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/formatting.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"begin\n source_code = source.code\n result = Crystal.format(source_code, source.path)\n if result == source_code\n return\n end\n source_lines = source_code.lines\n if source_lines.empty?\n return\n end\n end_location = {source_lines.size, source_lines.last.size + 1}\n issue_for(LOCATION, MSG) do |corrector|\n corrector.replace(LOCATION, end_location, result)\n end\nrescue ex : Crystal::SyntaxException\n if fail_on_error?\n issue_for({ex.line_number, ex.column_number}, MSG_ERROR % ex.message)\n end\nrescue ex\n if fail_on_error?\n issue_for(LOCATION, MSG_ERROR % ex.message)\n end\nend"}}]},{"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/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated keys in hash literal: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::HashLiteral)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if (keys = duplicated_keys(node.entries)).empty?\n return\nend\nissue_for(node, MSG % (keys.join(\", \")))\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","path":"Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions","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_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Detected assignment with a literal value in control expression\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if (cond = node.cond).is_a?(Crystal::Assign)\nelse\n return\nend\nif literal?(cond.value)\nelse\n return\nend\nissue_for(cond, MSG)\n"}}]},{"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":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_in_condition.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in conditional\""}],"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"}],"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\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_in_condition.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literal_in_condition.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"visibility":"Public","body":"if static_literal?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in interpolation\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"node.expressions.select do |exp|\n (!exp.is_a?(Crystal::StringLiteral)) && (literal?(exp))\nend.each do |exp|\n issue_for(exp, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralsComparison","path":"Ameba/Rule/Lint/LiteralsComparison.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison","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/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L19"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison always evaluates to %s\""},{"id":"MSG_LIKELY","name":"MSG_LIKELY","value":"\"Comparison most likely evaluates to %s\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"===\", \"==\", \"!=\"] of ::String"}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L19"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/literals_comparison.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif (obj = node.obj) && (arg = node.args.first?)\nelse\n return\nend\nobj_is_literal, obj_is_static = literal_kind?(obj)\narg_is_literal, arg_is_static = literal_kind?(arg)\nif obj_is_literal && arg_is_literal\nelse\n return\nend\nif obj.to_s == arg.to_s\nelse\n return\nend\nis_dynamic = (!obj_is_static) || (!arg_is_static)\nwhat = case node.name\nwhen \"===\"\n \"the same\"\nwhen \"==\"\n \"true\"\nwhen \"!=\"\n \"false\"\nend\nissue_for(node, (is_dynamic ? MSG_LIKELY : MSG) % what)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","path":"Ameba/Rule/Lint/MissingBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument","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/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Missing anonymous block argument. Use `&` as an argument name to indicate yielding method.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/missing_block_argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if (!scope.yields?) || node.block_arg\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/missing_block_argument.cr#L30"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","path":"Ameba/Rule/Lint/NotNil.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil","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/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid using `not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"not_nil!\"\nelse\n return\nend\nif node.obj && node.args.empty?\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","path":"Ameba/Rule/Lint/NotNilAfterNoBang.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang","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/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BLOCK_CALL_NAMES","name":"BLOCK_CALL_NAMES","value":"[\"index\", \"rindex\", \"find\"] of ::String"},{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"index\", \"rindex\", \"match\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s! {...}` instead of `%s {...}.not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usage of `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"not_nil!\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.name.in?(obj.block ? BLOCK_CALL_NAMES : CALL_NAMES)\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif name_location_end = name_end_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {obj.name, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.insert_after(name_location_end, '!')\n corrector.remove_trailing(node, {{ \".not_nil!\".size }})\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/not_nil_after_no_bang.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/e6a5fa9/src/ameba/rule/lint/percent_array.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Symbols `%s` may be unwanted in %s array literals\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/percent_array.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"string_array_unwanted_symbols:String-instance-method","name":"string_array_unwanted_symbols","abstract":false,"def":{"name":"string_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"args_string":"(string_array_unwanted_symbols : String)","args_html":"(string_array_unwanted_symbols : String)","def":{"name":"string_array_unwanted_symbols=","args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"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","abstract":false,"def":{"name":"symbol_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"args_string":"(symbol_array_unwanted_symbols : String)","args_html":"(symbol_array_unwanted_symbols : String)","def":{"name":"symbol_array_unwanted_symbols=","args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"visibility":"Public","body":"@symbol_array_unwanted_symbols = symbol_array_unwanted_symbols"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/percent_array.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 = start_token) && (!issue)\n issue = array_entry_invalid?(token.value.to_s, _start.raw)\n end\n when .string_array_end?\n if (_start = start_token) && (_issue = issue)\n issue_for(_start, _issue)\n end\n issue = start_token = nil\n end\nend\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/rand_zero.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"%s always returns 0\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```","summary":"

A rule that disallows rand(0) and rand(1) calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/rand_zero.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/rand_zero.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name == \"rand\") && (node.args.size == 1)) && (arg = node.args.first).is_a?(Crystal::NumberLiteral)) && (arg.value.in?(\"0\", \"1\"))\nelse\n return\nend\nissue_for(node, MSG % node)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","path":"Ameba/Rule/Lint/RedundantStringCoercion.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion","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/redundant_string_coercion.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_string_coercion.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant use of `Object#to_s` in interpolation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"(string_coercion_nodes(node)).each do |expr|\n issue_for(name_location(expr), expr.end_location, MSG)\nend"}}]},{"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":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_index.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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\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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n\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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_index.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_index.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"args, block = node.args, node.block\nif block.nil? || args.size > 1\n return\nend\nif with_index_arg?(block)\n return\nend\ncase node.name\nwhen \"with_index\"\n report(source, node, \"Remove redundant with_index\")\nwhen \"each_with_index\"\n report(source, node, \"Use each instead of each_with_index\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","path":"Ameba/Rule/Lint/RedundantWithObject.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject","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_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_object.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `each` instead of `each_with_object`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_object.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/redundant_with_object.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name != \"each_with_object\") || (node.args.size != 1)) || (!(block = node.block))) || (with_index_arg?(block))\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","path":"Ameba/Rule/Lint/ShadowedArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument","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_argument.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Argument `%s` is assigned before it is used\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```","summary":"

A rule that disallows shadowed arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/shadowed_argument.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowed exception found: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L36"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/shadowed_exception.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"rescues = node.rescues\nif rescues.nil?\n return\nend\n(shadowed(rescues)).each do |path|\n issue_for(path, MSG % (path.names.join(\"::\")))\nend\n"}}]},{"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_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowing outer local variable `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral|Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"find_shadowing(source, scope)"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/shadowing_outer_local_var.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroFor])"}}]},{"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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shared variable `%s` is used in fiber\""}],"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"}],"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 techniques 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 techniques 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","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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/SpecFilename","path":"Ameba/Rule/Lint/SpecFilename.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename","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_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L14"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Spec filename should have `_spec` suffix: %s.cr, not %s.cr\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L14"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignored_dirs:Array(String)-instance-method","name":"ignored_dirs","abstract":false,"def":{"name":"ignored_dirs","visibility":"Public","body":"@ignored_dirs"}},{"html_id":"ignored_dirs=(ignored_dirs:Array(String))-instance-method","name":"ignored_dirs=","abstract":false,"args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"args_string":"(ignored_dirs : Array(String))","args_html":"(ignored_dirs : Array(String))","def":{"name":"ignored_dirs=","args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_dirs = ignored_dirs"}},{"html_id":"ignored_filenames:Array(String)-instance-method","name":"ignored_filenames","abstract":false,"def":{"name":"ignored_filenames","visibility":"Public","body":"@ignored_filenames"}},{"html_id":"ignored_filenames=(ignored_filenames:Array(String))-instance-method","name":"ignored_filenames=","abstract":false,"args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"args_string":"(ignored_filenames : Array(String))","args_html":"(ignored_filenames : Array(String))","def":{"name":"ignored_filenames=","args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_filenames = ignored_filenames"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source:Source)-instance-method","name":"test","doc":"TODO: fix the assumption that *source.path* contains relative path","summary":"

TODO fix the assumption that source.path contains relative path

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_filename.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path_ = Path[source.path].to_posix\nname = path_.stem\npath = path_.to_s\nif path.starts_with?(\"spec/\")\nelse\n return\nend\nif path.ends_with?(\".cr\")\nelse\n return\nend\nif name.ends_with?(\"_spec\")\n return\nend\nignored_dirs.each do |substr|\n if path.starts_with?(\"#{substr}/\")\n return\n end\nend\nif name.in?(ignored_filenames)\n return\nend\nexpected = \"#{name}_spec\"\nissue_for(LOCATION, MSG % {expected, name}) do\n new_path = path_.sibling(expected + path_.extension)\n FileUtils.mv(path, new_path)\nend\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\""},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L47"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":62,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L62"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nelse\n return\nend\nissue_for(arg, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":56,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/spec_focus.cr#L56"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}]},{"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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L21"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L21"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","return_type":"Ameba::Severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/syntax.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Typos","path":"Ameba/Rule/Lint/Typos.html","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos","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/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BIN_PATH","name":"BIN_PATH","value":"Process.find_executable(\"typos\")"},{"id":"MSG","name":"MSG","value":"\"Typo found: %s -> %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L15"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"bin_path:String|Nil-instance-method","name":"bin_path","abstract":false,"location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L27"},"def":{"name":"bin_path","return_type":"String | ::Nil","visibility":"Public","body":"@bin_path || BIN_PATH"}},{"html_id":"bin_path=(bin_path:Union(String,Nil))-instance-method","name":"bin_path=","abstract":false,"args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"args_string":"(bin_path : Union(String, Nil))","args_html":"(bin_path : Union(String, Nil))","def":{"name":"bin_path=","args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"visibility":"Public","body":"@bin_path = bin_path"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/typos.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"begin\n typos = typos_from(source)\n typos.try(&.each do |typo|\n corrections = typo.corrections\n message = MSG % {typo.typo, corrections.join(\" | \")}\n if corrections.size == 1\n issue_for(typo.location, typo.end_location, message) do |corrector|\n corrector.replace(typo.location, typo.end_location, corrections.first)\n end\n else\n issue_for(typo.location, typo.end_location, message)\n end\n end)\nrescue ex\n if fail_on_error?\n raise(ex)\n end\nend"}}]},{"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/e6a5fa9/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unnecessary disabling of %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L44"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unreachable code detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L44"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","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":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"visibility":"Public","body":"if unreachable_node = flow_expression.unreachable_nodes.first?\nelse\n return\nend\nissue_for(unreachable_node, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unreachable_code.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::FlowExpressionVisitor.new(self, source)"}}]},{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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.\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","name":"ignore_blocks=","abstract":false,"args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"args_string":"(ignore_blocks : Bool)","args_html":"(ignore_blocks : Bool)","def":{"name":"ignore_blocks=","args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_blocks = ignore_blocks"}},{"html_id":"ignore_blocks?:Bool-instance-method","name":"ignore_blocks?","abstract":false,"def":{"name":"ignore_blocks?","return_type":"Bool","visibility":"Public","body":"@ignore_blocks"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_procs=(ignore_procs:Bool)-instance-method","name":"ignore_procs=","abstract":false,"args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"args_string":"(ignore_procs : Bool)","args_html":"(ignore_procs : Bool)","def":{"name":"ignore_procs=","args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_procs = ignore_procs"}},{"html_id":"ignore_procs?:Bool-instance-method","name":"ignore_procs?","abstract":false,"def":{"name":"ignore_procs?","return_type":"Bool","visibility":"Public","body":"@ignore_procs"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L44"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_procs? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_blocks? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Def, scope : AST::Scope)","args_html":"(source, node : Crystal::Def, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"arguments = scope.arguments.dup\nif block_arg = node.block_arg\n arguments.reject!() do |__arg0|\n __arg0.node == block_arg\n end\nend\nignore_defs? || (find_unused_arguments(source, scope, arguments))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_argument.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/UnusedBlockArgument","path":"Ameba/Rule/Lint/UnusedBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument","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_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_UNUSED","name":"MSG_UNUSED","value":"\"Unused block argument `%1$s`. If it's necessary, use `_%1$s` as an argument name to indicate that it won't be used.\""},{"id":"MSG_YIELDED","name":"MSG_YIELDED","value":"\"Use `&` as an argument name to indicate that it won't be referenced.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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_block_argument.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if node.abstract?\n return\nend\nif block_arg = node.block_arg\nelse\n return\nend\nif block_arg = scope.arguments.find() do |__arg0|\n __arg0.node == block_arg\nend\nelse\n return\nend\nif block_arg.anonymous?\n return\nend\nif scope.references?(block_arg.variable)\n return\nend\nlocation = block_arg.node.location\nend_location = location.try(&.adjust(column_number: block_arg.name.size - 1))\ncase\nwhen scope.yields?\n if location && end_location\n issue_for(location, end_location, MSG_YIELDED) do |corrector|\n corrector.remove(location, end_location)\n end\n else\n issue_for(block_arg.node, MSG_YIELDED)\n end\nwhen !block_arg.ignored?\n if location && end_location\n issue_for(location, end_location, MSG_UNUSED % block_arg.name) do |corrector|\n corrector.insert_before(location, '_')\n end\n else\n issue_for(block_arg.node, MSG_UNUSED % block_arg.name)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/unused_block_argument.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless assignment to variable `%s`\""}],"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"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_type_declarations=(exclude_type_declarations:Bool)-instance-method","name":"exclude_type_declarations=","abstract":false,"args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"args_string":"(exclude_type_declarations : Bool)","args_html":"(exclude_type_declarations : Bool)","def":{"name":"exclude_type_declarations=","args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"visibility":"Public","body":"@exclude_type_declarations = exclude_type_declarations"}},{"html_id":"exclude_type_declarations?:Bool-instance-method","name":"exclude_type_declarations?","abstract":false,"def":{"name":"exclude_type_declarations?","return_type":"Bool","visibility":"Public","body":"@exclude_type_declarations"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if scope.lib_def?(check_outer_scopes: true)\n return\nend\nscope.variables.each do |var|\n if (var.ignored? || var.used_in_macro?) || var.captured_by_block?\n next\n end\n if exclude_type_declarations? && (scope.assigns_type_dec?(var.name))\n next\n end\n var.assignments.each do |assign|\n check_assignment(source, assign, var)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/lint/useless_assign.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless condition in when detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::When)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"ConditionInWhenVisitor.new(self, source, node)"}}]}]},{"html_id":"ameba/Ameba/Rule/Metrics","path":"Ameba/Rule/Metrics.html","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics","abstract":false,"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Cyclomatic complexity too high [%d/%d]\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_complexity:Int32-instance-method","name":"max_complexity","abstract":false,"def":{"name":"max_complexity","return_type":"Int32","visibility":"Public","body":"@max_complexity"}},{"html_id":"max_complexity=(max_complexity:Int32)-instance-method","name":"max_complexity=","abstract":false,"args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"args_string":"(max_complexity : Int32)","args_html":"(max_complexity : Int32)","def":{"name":"max_complexity=","args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"visibility":"Public","body":"@max_complexity = max_complexity"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/metrics/cyclomatic_complexity.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"complexity = (AST::CountingVisitor.new(node)).count\nif complexity > max_complexity\nelse\n return\nend\nissue_for(node, MSG % {complexity, max_complexity}, prefer_name_location: true)\n"}}]}]},{"html_id":"ameba/Ameba/Rule/Naming","path":"Ameba/Rule/Naming.html","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming","abstract":false,"locations":[{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L1"},{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L1"},{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L1"},{"filename":"src/ameba/rule/naming/filename.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L1"},{"filename":"src/ameba/rule/naming/method_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L1"},{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L1"},{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L1"},{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L1"},{"filename":"src/ameba/rule/naming/type_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L1"},{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Naming/AccessorMethodName","path":"Ameba/Rule/Naming/AccessorMethodName.html","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName","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/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"defs = case body = node.body\nwhen Crystal::Def\n [body]\nwhen Crystal::Expressions\n body.expressions.select(Crystal::Def)\nend\ndefs.try(&.each do |def_node|\n if def_node.receiver\n else\n check_issue(source, def_node)\n end\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/accessor_method_name.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.receiver\n check_issue(source, node)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","path":"Ameba/Rule/Naming/AsciiIdentifiers.html","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers","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/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Identifier contains non-ascii characters\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_symbols=(ignore_symbols:Bool)-instance-method","name":"ignore_symbols=","abstract":false,"args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"args_string":"(ignore_symbols : Bool)","args_html":"(ignore_symbols : Bool)","def":{"name":"ignore_symbols=","args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"visibility":"Public","body":"@ignore_symbols = ignore_symbols"}},{"html_id":"ignore_symbols?:Bool-instance-method","name":"ignore_symbols?","abstract":false,"def":{"name":"ignore_symbols?","return_type":"Bool","visibility":"Public","body":"@ignore_symbols"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\n check_issue(source, target, target)\nend\ncheck_symbol_literal(source, node.value)\n"}},{"html_id":"test(source,node:Crystal::MultiAssign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(source, node : Crystal::MultiAssign)","args_html":"(source, node : Crystal::MultiAssign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"node.values.each do |value|\n check_symbol_literal(source, value)\nend"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L46"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.args.each do |arg|\n check_symbol_literal(source, arg)\nend\nnode.named_args.try(&.each do |arg|\n check_symbol_literal(source, arg.value)\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)\nnode.args.each do |arg|\n check_issue(source, arg, prefer_name_location: true)\n check_symbol_literal(source, arg.default_value)\nend\n"}},{"html_id":"test(source,node:Crystal::ClassVar|Crystal::InstanceVar|Crystal::Var|Crystal::Alias)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"args_string":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","args_html":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L64"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef|Crystal::EnumDef|Crystal::LibDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/ascii_identifiers.cr#L68"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"visibility":"Public","body":"check_issue(source, node.name, node.name)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","path":"Ameba/Rule/Naming/BinaryOperatorParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName","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/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"When defining the `%s` operator, name its argument `other`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"excluded_operators:Array(String)-instance-method","name":"excluded_operators","abstract":false,"def":{"name":"excluded_operators","visibility":"Public","body":"@excluded_operators"}},{"html_id":"excluded_operators=(excluded_operators:Array(String))-instance-method","name":"excluded_operators=","abstract":false,"args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"args_string":"(excluded_operators : Array(String))","args_html":"(excluded_operators : Array(String))","def":{"name":"excluded_operators=","args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"visibility":"Public","body":"@excluded_operators = excluded_operators"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/binary_operator_parameter_name.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name\nif (name == \"->\") || (name.in?(excluded_operators))\n return\nend\nif name.chars.any?(&.alphanumeric?)\n return\nend\nif node.args.size == 1\nelse\n return\nend\nif (arg = node.args.first).name == \"other\"\n return\nend\nissue_for(arg, MSG % name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","path":"Ameba/Rule/Naming/BlockParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName","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/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed block parameter name found\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_names_ending_in_numbers=(allow_names_ending_in_numbers:Bool)-instance-method","name":"allow_names_ending_in_numbers=","abstract":false,"args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"args_string":"(allow_names_ending_in_numbers : Bool)","args_html":"(allow_names_ending_in_numbers : Bool)","def":{"name":"allow_names_ending_in_numbers=","args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"visibility":"Public","body":"@allow_names_ending_in_numbers = allow_names_ending_in_numbers"}},{"html_id":"allow_names_ending_in_numbers?:Bool-instance-method","name":"allow_names_ending_in_numbers?","abstract":false,"def":{"name":"allow_names_ending_in_numbers?","return_type":"Bool","visibility":"Public","body":"@allow_names_ending_in_numbers"}},{"html_id":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"forbidden_names:Array(String)-instance-method","name":"forbidden_names","abstract":false,"def":{"name":"forbidden_names","visibility":"Public","body":"@forbidden_names"}},{"html_id":"forbidden_names=(forbidden_names:Array(String))-instance-method","name":"forbidden_names=","abstract":false,"args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"args_string":"(forbidden_names : Array(String))","args_html":"(forbidden_names : Array(String))","def":{"name":"forbidden_names=","args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@forbidden_names = forbidden_names"}},{"html_id":"min_name_length:Int32-instance-method","name":"min_name_length","abstract":false,"def":{"name":"min_name_length","return_type":"Int32","visibility":"Public","body":"@min_name_length"}},{"html_id":"min_name_length=(min_name_length:Int32)-instance-method","name":"min_name_length=","abstract":false,"args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"args_string":"(min_name_length : Int32)","args_html":"(min_name_length : Int32)","def":{"name":"min_name_length=","args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"visibility":"Public","body":"@min_name_length = min_name_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/block_parameter_name.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.try(&.block).try(&.args).try(&.each do |arg|\n if valid_name?(arg.name)\n else\n issue_for(arg, MSG)\n end\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","path":"Ameba/Rule/Naming/ConstantNames.html","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames","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/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Constant name should be screaming-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/constant_names.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\nelse\n return\nend\nname = target.to_s\nexpected = name.upcase\nif name.in?(expected, name.camelcase)\n return\nend\nissue_for(target, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/Filename","path":"Ameba/Rule/Naming/Filename.html","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename","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/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Filename should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/filename.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path = Path[source.path]\nname = path.basename\nif (expected = name.underscore) == name\n return\nend\nissue_for(LOCATION, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","path":"Ameba/Rule/Naming/MethodNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Method name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/method_names.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","path":"Ameba/Rule/Naming/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s?' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/predicate_name.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.name =~ (/^is_([a-z]\\w*)\\??$/)\nelse\n return\nend\nalternative = $~[1]\nissue_for(node, MSG % {alternative, node.name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","path":"Ameba/Rule/Naming/QueryBoolMethods.html","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods","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/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"getter\", \"class_getter\", \"property\", \"class_property\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Consider using '%s?' for '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/query_bool_methods.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"calls = case body = node.body\nwhen Crystal::Call\n if body.name.in?(CALL_NAMES)\n [body]\n end\nwhen Crystal::Expressions\n (body.expressions.select(Crystal::Call)).select!() do |__arg0|\n __arg0.name.in?(CALL_NAMES)\n end\nend\ncalls.try(&.each do |exp|\n exp.args.each do |arg|\n name_node, is_bool = case arg\n when Crystal::Assign\n {arg.target, arg.value.is_a?(Crystal::BoolLiteral)}\n when Crystal::TypeDeclaration\n {arg.var, path_named?(arg.declared_type, \"Bool\")}\n else\n {nil, false}\n end\n if name_node && is_bool\n issue_for(name_node, MSG % {exp.name, name_node})\n end\n end\nend)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","path":"Ameba/Rule/Naming/RescuedExceptionsVariableName.html","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName","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/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed variable name, use one of these instead: '%s'\""},{"id":"MSG_SINGULAR","name":"MSG_SINGULAR","value":"\"Disallowed variable name, use '%s' instead\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node.rescues.try(&.each do |rescue_node|\n if valid_name?(rescue_node.name)\n next\n end\n message = allowed_names.size == 1 ? MSG_SINGULAR : MSG\n issue_for(rescue_node, message % (allowed_names.join(\"', '\")))\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","path":"Ameba/Rule/Naming/TypeNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Type name should be camelcased: %s, but it was %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Alias|Crystal::ClassDef|Crystal::ModuleDef|Crystal::LibDef|Crystal::EnumDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"args_string":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","args_html":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/type_names.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.camelcase) == name\n return\nend\nissue_for(node.name, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","path":"Ameba/Rule/Naming/VariableNames.html","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames","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/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Var name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Var|Crystal::InstanceVar|Crystal::ClassVar)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"args_string":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","args_html":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name})\n"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/naming/variable_names.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"VarVisitor.new(self, source)"}}]}]},{"html_id":"ameba/Ameba/Rule/Performance","path":"Ameba/Rule/Performance.html","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance","abstract":false,"locations":[{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L3"},{"filename":"src/ameba/rule/performance/base.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/base.cr#L3"},{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L3"},{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L3"},{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L3"},{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","path":"Ameba/Rule/Performance/AnyAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `any? {...}` instead of `%s {...}.any?`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_after_filter.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"any?\") && (obj = node.obj)\nelse\n return\nend\nif (obj.is_a?(Crystal::Call) && obj.block) && node.block.nil?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","path":"Ameba/Rule/Performance/AnyInsteadOfEmpty.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty","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/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `!{...}.empty?` instead of `{...}.any?`\""}],"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"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/any_instead_of_empty.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"any?\"\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif node.obj\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/Base","path":"Ameba/Rule/Performance/Base.html","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base","abstract":true,"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/performance/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/base.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"A general base class for performance rules.","summary":"

A general base class for performance rules.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/performance/base.cr#L5"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/performance/base.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/base.cr#L6"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.spec? ? source : super(source)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","path":"Ameba/Rule/Performance/ChainedCallWithNoBang.html","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALLOCATING_METHOD_NAMES","name":"ALLOCATING_METHOD_NAMES","value":"[\"keys\", \"values\", \"values_at\", \"map\", \"map_with_index\", \"flat_map\", \"compact_map\", \"flatten\", \"compact\", \"select\", \"reject\", \"sample\", \"group_by\", \"chunks\", \"tally\", \"merge\", \"combinations\", \"repeated_combinations\", \"permutations\", \"repeated_permutations\", \"transpose\", \"invert\", \"chars\", \"captures\", \"named_captures\", \"clone\"] of ::String","doc":"All these methods allocate a new object","summary":"

All these methods allocate a new object

"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"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","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nif end_location = name_end_location(node)\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true) do |corrector|\n corrector.insert_after(end_location, '!')\n end\nelse\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/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/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/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","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.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"compact\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/compact_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","path":"Ameba/Rule/Performance/ExcessiveAllocations.html","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L32"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `%s.each {...}` to avoid excessive allocation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L32"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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:Hash(String,String)-instance-method","name":"call_names","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Hash(String,String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"args_string":"(call_names : Hash(String, String))","args_html":"(call_names : Hash(String, String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"each\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.args.empty? && obj.block.nil?\nelse\n return\nend\nif method = call_names[obj.name]?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {method, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.replace(name_location, end_location, method)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/excessive_allocations.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","path":"Ameba/Rule/Performance/FirstLastAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"first\", \"last\", \"first?\", \"last?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `find {...}` instead of `%s {...}.%s`\""},{"id":"MSG_REVERSE","name":"MSG_REVERSE","value":"\"Use `reverse_each.find {...}` instead of `%s {...}.%s`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nmessage = node.name.includes?(CALL_NAMES.first) ? MSG : MSG_REVERSE\nissue_for(name_location(obj), name_end_location(node), message % {obj.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/first_last_after_filter.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","path":"Ameba/Rule/Performance/FlattenAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `flat_map {...}` instead of `map {...}.flatten`\""}],"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"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"flatten\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/flatten_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","path":"Ameba/Rule/Performance/MapInsteadOfBlock.html","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"sum\", \"product\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`\""}],"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"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % {node.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/map_instead_of_block.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","path":"Ameba/Rule/Performance/MinMaxAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"min\", \"min?\", \"max\", \"max?\", \"minmax\", \"minmax?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`.\""}],"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"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L42"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name.in?(CALL_NAMES)) && node.block.nil?) && node.args.empty?\nelse\n return\nend\nif (obj = node.obj) && obj.is_a?(Crystal::Call)\nelse\n return\nend\nif ((obj.name == \"map\") && obj.block) && obj.args.empty?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nof_name = node.name.sub(/(.+?)(\\?)?$/, \"\\\\1_of\\\\2\")\nmessage = MSG % {of_name, node.name}\nissue_for(name_location, end_location, message) do |corrector|\n if node_name_location = name_location(node)\n else\n next\n end\n corrector.replace(name_location, name_location.adjust(column_number: {{ \"map\".size - 1 }}), of_name)\n corrector.remove(node_name_location.adjust(column_number: -1), end_location)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/minmax_after_map.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","path":"Ameba/Rule/Performance/SizeAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `count {...}` instead of `%s {...}.size`.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":49,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"size\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/performance/size_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]}]},{"html_id":"ameba/Ameba/Rule/Style","path":"Ameba/Rule/Style.html","kind":"module","full_name":"Ameba::Rule::Style","name":"Style","abstract":false,"locations":[{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L1"},{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L1"},{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L1"},{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L1"},{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L1"},{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L1"},{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L1"},{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L1"},{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L1"},{"filename":"src/ameba/rule/style/unless_else.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/unless_else.cr#L1"},{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L1"},{"filename":"src/ameba/rule/style/while_true.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/while_true.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Style/GuardClause","path":"Ameba/Rule/Style/GuardClause.html","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause","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/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use a guard clause (`%s`) instead of wrapping the code inside a conditional expression.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"guard_clause_source(source,guard_clause,parent)-instance-method","name":"guard_clause_source","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"args_string":"(source, guard_clause, parent)","args_html":"(source, guard_clause, parent)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L180"},"def":{"name":"guard_clause_source","args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"visibility":"Public","body":"node = parent.is_a?(Crystal::BinaryOp) ? parent : guard_clause\nnode_source(node, source.lines)\n"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L71"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"final_expression = if (body = node.body).is_a?(Crystal::Expressions)\n body.last\nelse\n body\nend\ncase final_expression\nwhen Crystal::If, Crystal::Unless\n check_ending_if(source, final_expression)\nend\n"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"args_string":"(source, node : Crystal::If | Crystal::Unless)","args_html":"(source, node : Crystal::If | Crystal::Unless)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":85,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L85"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"visibility":"Public","body":"if accepted_form?(source, node, ending: false)\n return\nend\ncase\nwhen guard_clause = guard_clause(node.then)\n parent, conditional_keyword = node.then, keyword(node)\nwhen guard_clause = guard_clause(node.else)\n parent, conditional_keyword = node.else, opposite_keyword(node)\nend\nif (guard_clause && parent) && conditional_keyword\nelse\n return\nend\nguard_clause_source = guard_clause_source(source, guard_clause, parent)\nreport_issue(source, node, guard_clause_source, conditional_keyword)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/guard_clause.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Assign])"}}]},{"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/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/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s` instead of `%s`\""},{"id":"NEW","name":"NEW","value":"\"%s(%s)\""},{"id":"OLD","name":"OLD","value":"\"%s {...}\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L41"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L58"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(filter_names)\nelse\n return\nend\nif filter_location = name_location(node)\nelse\n return\nend\nif block = node.block\nelse\n return\nend\nif (body = block.body).is_a?(Crystal::IsA)\nelse\n return\nend\nif (path = body.const).is_a?(Crystal::Path)\nelse\n return\nend\nif body.obj.is_a?(Crystal::Var)\nelse\n return\nend\nif block.args.size > 1\n return\nend\nname = path.names.join(\"::\")\nif path.global? && (!body.nil_check?)\n name = \"::#{name}\"\nend\nend_location = node.end_location\nif (!end_location) || end_location.try() do |__arg0|\n __arg0.column_number.zero?\nend\n if end_location = path.end_location\n end_location = end_location.adjust(column_number: 1)\n end\nend\nold = OLD % node.name\nnew = NEW % {node.name, name}\nmsg = MSG % {new, old}\nif end_location\n issue_for(filter_location, end_location, msg) do |corrector|\n corrector.replace(filter_location, end_location, new)\n end\nelse\n issue_for(filter_location, nil, msg)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_filter.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Style/IsANil","path":"Ameba/Rule/Style/IsANil.html","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil","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/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `nil?` instead of `is_a?(Nil)`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::IsA)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(source, node : Crystal::IsA)","args_html":"(source, node : Crystal::IsA)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/is_a_nil.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if node.nil_check?\n return\nend\nconst = node.const\nif path_named?(const, \"Nil\")\nelse\n return\nend\nissue_for(const, MSG) do |corrector|\n corrector.replace(node, \"#{node.obj}.nil?\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","path":"Ameba/Rule/Style/LargeNumbers.html","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers","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/large_numbers.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Large numbers should be written with underscores: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"int_min_digits:Int32-instance-method","name":"int_min_digits","abstract":false,"def":{"name":"int_min_digits","return_type":"Int32","visibility":"Public","body":"@int_min_digits"}},{"html_id":"int_min_digits=(int_min_digits:Int32)-instance-method","name":"int_min_digits=","abstract":false,"args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"args_string":"(int_min_digits : Int32)","args_html":"(int_min_digits : Int32)","def":{"name":"int_min_digits=","args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"visibility":"Public","body":"@int_min_digits = int_min_digits"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/rule/style/large_numbers.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 location = token.location\n end_location = location.adjust(column_number: token.raw.size - 1)\n issue_for(location, end_location, MSG % expected) do |corrector|\n corrector.replace(location, end_location, expected)\n end\n end\nend"}}]},{"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/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid negated conditions in unless blocks\""}],"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"}],"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.empty?\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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.empty?\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","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/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if negated_condition?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","path":"Ameba/Rule/Style/ParenthesesAroundCondition.html","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition","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/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_MISSING","name":"MSG_MISSING","value":"\"Missing parentheses\""},{"id":"MSG_REDUNDANT","name":"MSG_REDUNDANT","value":"\"Redundant parentheses\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_safe_assignment=(allow_safe_assignment:Bool)-instance-method","name":"allow_safe_assignment=","abstract":false,"args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"args_string":"(allow_safe_assignment : Bool)","args_html":"(allow_safe_assignment : Bool)","def":{"name":"allow_safe_assignment=","args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"visibility":"Public","body":"@allow_safe_assignment = allow_safe_assignment"}},{"html_id":"allow_safe_assignment?:Bool-instance-method","name":"allow_safe_assignment?","abstract":false,"def":{"name":"allow_safe_assignment?","return_type":"Bool","visibility":"Public","body":"@allow_safe_assignment"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_ternary=(exclude_ternary:Bool)-instance-method","name":"exclude_ternary=","abstract":false,"args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"args_string":"(exclude_ternary : Bool)","args_html":"(exclude_ternary : Bool)","def":{"name":"exclude_ternary=","args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"visibility":"Public","body":"@exclude_ternary = exclude_ternary"}},{"html_id":"exclude_ternary?:Bool-instance-method","name":"exclude_ternary?","abstract":false,"def":{"name":"exclude_ternary?","return_type":"Bool","visibility":"Public","body":"@exclude_ternary"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/parentheses_around_condition.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"cond = node.cond\nif cond.is_a?(Crystal::Assign) && allow_safe_assignment?\n issue_for(cond, MSG_MISSING) do |corrector|\n corrector.wrap(cond, '(', ')')\n end\n return\nend\nis_ternary = node.is_a?(Crystal::If) && node.ternary?\nif is_ternary && exclude_ternary?\n return\nend\nif cond.is_a?(Crystal::Expressions)\nelse\n return\nend\nif cond.keyword.paren?\nelse\n return\nend\nif exp = cond.single_expression?\nelse\n return\nend\nif strip_parentheses?(exp, is_ternary)\nelse\n return\nend\nissue_for(cond, MSG_REDUNDANT) do |corrector|\n corrector.remove_trailing(cond, 1)\n corrector.remove_leading(cond, 1)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","path":"Ameba/Rule/Style/RedundantBegin.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin","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/style/redundant_begin.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L58"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `begin` block detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```","summary":"

A rule that disallows redundant begin blocks.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L58"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/e6a5fa9/src/ameba/rule/style/redundant_begin.cr#L67"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if def_loc = node.location\nelse\n return\nend\ncase body = node.body\nwhen Crystal::ExceptionHandler\n if (begin_exprs_in_handler?(body)) || (inner_handler?(body))\n return\n end\nwhen Crystal::Expressions\n if redundant_begin_in_expressions?(body)\n else\n return\n end\nelse\n return\nend\nif begin_range = def_redundant_begin_range(source, node)\nelse\n return\nend\nbegin_loc, end_loc = begin_range\nbegin_loc, end_loc = def_loc.seek(begin_loc), def_loc.seek(end_loc)\nbegin_end_loc = begin_loc.adjust(column_number: {{ \"begin\".size - 1 }})\nend_end_loc = end_loc.adjust(column_number: {{ \"end\".size - 1 }})\nissue_for(begin_loc, begin_end_loc, MSG) do |corrector|\n corrector.remove(begin_loc, begin_end_loc)\n corrector.remove(end_loc, end_end_loc)\nend\n"}}]},{"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/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/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L99"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `next` detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L99"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_next:Bool)-instance-method","name":"allow_empty_next=","abstract":false,"args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"args_string":"(allow_empty_next : Bool)","args_html":"(allow_empty_next : Bool)","def":{"name":"allow_empty_next=","args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_next = allow_empty_next"}},{"html_id":"allow_empty_next?:Bool-instance-method","name":"allow_empty_next?","abstract":false,"def":{"name":"allow_empty_next?","return_type":"Bool","visibility":"Public","body":"@allow_empty_next"}},{"html_id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","name":"allow_multi_next=","abstract":false,"args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"args_string":"(allow_multi_next : Bool)","args_html":"(allow_multi_next : Bool)","def":{"name":"allow_multi_next=","args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_next = allow_multi_next"}},{"html_id":"allow_multi_next?:Bool-instance-method","name":"allow_multi_next?","abstract":false,"def":{"name":"allow_multi_next?","return_type":"Bool","visibility":"Public","body":"@allow_multi_next"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","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":115,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L115"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Block)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":111,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_next.cr#L111"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/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/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `return` detected\""}],"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"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","abstract":false,"args":[{"name":"config","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/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L96"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_return:Bool)-instance-method","name":"allow_empty_return=","abstract":false,"args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"args_string":"(allow_empty_return : Bool)","args_html":"(allow_empty_return : Bool)","def":{"name":"allow_empty_return=","args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_return = allow_empty_return"}},{"html_id":"allow_empty_return?:Bool-instance-method","name":"allow_empty_return?","abstract":false,"def":{"name":"allow_empty_return?","return_type":"Bool","visibility":"Public","body":"@allow_empty_return"}},{"html_id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","name":"allow_multi_return=","abstract":false,"args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"args_string":"(allow_multi_return : Bool)","args_html":"(allow_multi_return : Bool)","def":{"name":"allow_multi_return=","args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_return = allow_multi_return"}},{"html_id":"allow_multi_return?:Bool-instance-method","name":"allow_multi_return?","abstract":false,"def":{"name":"allow_multi_return?","return_type":"Bool","visibility":"Public","body":"@allow_multi_return"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","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":112,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L112"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":108,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/redundant_return.cr#L108"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/e6a5fa9/src/ameba/rule/style/unless_else.cr#L45"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour if over unless with else\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```","summary":"

A rule that disallows the use of an else block with the unless.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/unless_else.cr#L45"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/unless_else.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if node.else.nop?\n return\nend\nlocation = node.location\ncond_end_location = node.cond.end_location\nelse_location = node.else_location\nend_location = node.end_location\nif ((location && cond_end_location) && else_location) && end_location\nelse\n issue_for(node, MSG)\n return\nend\nissue_for(location, cond_end_location, MSG) do |corrector|\n keyword_begin_pos = source.pos(location)\n keyword_end_pos = keyword_begin_pos + ({{ \"unless\".size }})\n keyword_range = keyword_begin_pos...keyword_end_pos\n cond_end_pos = source.pos(cond_end_location, end: true)\n else_begin_pos = source.pos(else_location)\n body_range = cond_end_pos...else_begin_pos\n else_end_pos = else_begin_pos + ({{ \"else\".size }})\n end_end_pos = source.pos(end_location, end: true)\n end_begin_pos = end_end_pos - ({{ \"end\".size }})\n else_range = else_end_pos...end_begin_pos\n corrector.replace(keyword_range, \"if\")\n corrector.replace(body_range, source.code[else_range])\n corrector.replace(else_range, source.code[body_range])\nend\n"}}]},{"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/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/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\""},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%s`\""}],"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"}],"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 ExcludeCallsWithBlock: 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeCallsWithBlock: 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","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/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","abstract":false,"args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block?:Bool-instance-method","name":"exclude_calls_with_block?","abstract":false,"def":{"name":"exclude_calls_with_block?","return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","abstract":false,"args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks?:Bool-instance-method","name":"exclude_multiple_line_blocks?","abstract":false,"def":{"name":"exclude_multiple_line_blocks?","return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","abstract":false,"args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_operators?:Bool-instance-method","name":"exclude_operators?","abstract":false,"def":{"name":"exclude_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","abstract":false,"args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators?:Bool-instance-method","name":"exclude_prefix_operators?","abstract":false,"def":{"name":"exclude_prefix_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","abstract":false,"args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"html_id":"exclude_setters?:Bool-instance-method","name":"exclude_setters?","abstract":false,"def":{"name":"exclude_setters?","return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Union(Int32,Nil)-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Union(Int32,Nil))-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_length : Union(Int32, Nil))","args_html":"(max_length : Union(Int32, Nil))","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Union(Int32,Nil)-instance-method","name":"max_line_length","abstract":false,"def":{"name":"max_line_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Union(Int32,Nil))-instance-method","name":"max_line_length=","abstract":false,"args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_line_length : Union(Int32, Nil))","args_html":"(max_line_length : Union(Int32, Nil))","def":{"name":"max_line_length=","args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_line_length = max_line_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/verbose_block.cr#L215"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\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, block, body)\n"}}]},{"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/e6a5fa9/src/ameba/rule/style/while_true.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"While statement using true literal as condition\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/while_true.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::While)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/rule/style/while_true.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if node.cond.true_literal?\nelse\n return\nend\nif location = node.location\nelse\n return\nend\nif end_location = node.cond.end_location\nelse\n return\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(location, end_location, \"loop do\")\nend\n"}}]}]}]},{"html_id":"ameba/Ameba/Runner","path":"Ameba/Runner.html","kind":"class","full_name":"Ameba::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/runner.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L12"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a runner for inspecting sources files.\nHolds a list of rules to do inspection based on,\nlist of sources to run inspection on and a formatter\nto prepare a report.\n\n```\nconfig = Ameba::Config.load\nrunner = Ameba::Runner.new config\nrunner.run.success? # => true or false\n```","summary":"

Represents a runner for inspecting sources files.

","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.

","abstract":false,"args":[{"name":"config","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","args_html":"(config : Config)","location":{"filename":"src/ameba/runner.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L61"},"def":{"name":"new","args":[{"name":"config","external_name":"config","restriction":"Config"}],"visibility":"Public","body":"_ = allocate\n_.initialize(config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"explain(location,output=STDOUT)-instance-method","name":"explain","doc":"Explains an issue at a specified *location*.\n\nRunner should perform inspection before doing the explain.\nThis is necessary to be able to find the issue at a specified location.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.explain({file: file, line: l, column: c})\n```","summary":"

Explains an issue at a specified location.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","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":160,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L160"},"def":{"name":"explain","args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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,"location":{"filename":"src/ameba/runner.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L87"},"def":{"name":"run","visibility":"Public","body":"begin\n @formatter.started(@sources)\n channels = @sources.map do\n Channel(Exception | ::Nil).new\n end\n (@sources.zip(channels)).each do |source, channel|\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,"location":{"filename":"src/ameba/runner.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L35"},"def":{"name":"sources","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,"location":{"filename":"src/ameba/runner.cr","line_number":172,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L172"},"def":{"name":"success?","visibility":"Public","body":"@sources.all? do |source|\n source.issues.reject(&.disabled?).none?() do |__arg7|\n __arg7.rule.severity <= @severity\n end\nend"}}],"types":[{"html_id":"ameba/Ameba/Runner/InfiniteCorrectionLoopError","path":"Ameba/Runner/InfiniteCorrectionLoopError.html","kind":"class","full_name":"Ameba::Runner::InfiniteCorrectionLoopError","name":"InfiniteCorrectionLoopError","abstract":false,"superclass":{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"ameba/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"ameba/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"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/runner.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Runner","kind":"class","full_name":"Ameba::Runner","name":"Runner"},"doc":"An error indicating that the inspection loop got stuck correcting\nissues back and forth.","summary":"

An error indicating that the inspection loop got stuck correcting issues back and forth.

","constructors":[{"html_id":"new(path,issues_by_iteration,loop_start=-1)-class-method","name":"new","abstract":false,"args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"args_string":"(path, issues_by_iteration, loop_start = -1)","args_html":"(path, issues_by_iteration, loop_start = -1)","location":{"filename":"src/ameba/runner.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/runner.cr#L16"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(path, issues_by_iteration, loop_start)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]}]},{"html_id":"ameba/Ameba/Severity","path":"Ameba/Severity.html","kind":"enum","full_name":"Ameba::Severity","name":"Severity","abstract":false,"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":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Error","name":"Error","value":"0"},{"id":"Warning","name":"Warning","value":"1"},{"id":"Convention","name":"Convention","value":"2"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/severity.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L41"},"def":{"name":"parse","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"begin\n super(name)\nrescue ArgumentError\n raise(\"Incorrect severity name #{name}. Try one of: #{values.map(&.to_s).join(\", \")}\")\nend"}}],"instance_methods":[{"html_id":"color:Colorize::Color-instance-method","name":"color","doc":"Returns a color uniquely indicating severity.\n\n```\nSeverity::Warning.color # => Colorize::ColorANSI::Red\n```","summary":"

Returns a color uniquely indicating severity.

","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L27"},"def":{"name":"color","return_type":"Colorize::Color","visibility":"Public","body":"case self\nin Error\n Colorize::ColorANSI::Red\nin Warning\n Colorize::ColorANSI::Red\nin Convention\n Colorize::ColorANSI::Blue\nend"}},{"html_id":"convention?-instance-method","name":"convention?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L7"},"def":{"name":"convention?","visibility":"Public","body":"self == Convention"}},{"html_id":"error?-instance-method","name":"error?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L5"},"def":{"name":"error?","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,"location":{"filename":"src/ameba/severity.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L14"},"def":{"name":"symbol","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?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L6"},"def":{"name":"warning?","visibility":"Public","body":"self == Warning"}}]},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L49"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Converter for `YAML.mapping` which converts severity enum to and from YAML.","summary":"

Converter for YAML.mapping which converts severity enum to and from YAML.

","class_methods":[{"html_id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"from_yaml","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":{"filename":"src/ameba/severity.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L50"},"def":{"name":"from_yaml","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"if node.is_a?(YAML::Nodes::Scalar)\nelse\n raise(\"Severity must be a scalar, not #{node.class}\")\nend\ncase value = node.value\nwhen String\n Severity.parse(value)\nwhen Nil\n raise(\"Missing severity\")\nelse\n raise(\"Incorrect severity: #{value}\")\nend\n"}},{"html_id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","name":"to_yaml","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"args_string":"(value : Severity, yaml : YAML::Nodes::Builder)","args_html":"(value : Severity, yaml : YAML::Nodes::Builder)","location":{"filename":"src/ameba/severity.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/severity.cr#L63"},"def":{"name":"to_yaml","args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"visibility":"Public","body":"yaml.scalar(value)"}}]},{"html_id":"ameba/Ameba/Source","path":"Ameba/Source.html","kind":"class","full_name":"Ameba::Source","name":"Source","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/source.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L4"},{"filename":"src/ameba/source/corrector.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L3"},{"filename":"src/ameba/source/rewriter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/support.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"An entity that represents a Crystal source file.\nHas path, lines of code and issues reported by rules.","summary":"

An entity that represents a Crystal source file.

","constructors":[{"html_id":"new(code:String,path:String=\"\",normalize=true)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"args_string":"(code : String, path : String = \"\", normalize = true)","args_html":"(code : String, path : String = "", normalize = true)","location":{"filename":"src/ameba/spec/support.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/support.cr#L11"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path, normalize)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(code:String,path:String=\"\")-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.

","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"args_string":"(code : String, path : String = \"\")","args_html":"(code : String, path : String = "")","location":{"filename":"src/ameba/source.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L22"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"ast:Crystal::ASTNode-instance-method","name":"ast","doc":"Returns AST nodes constructed by `Crystal::Parser`.\n\n```\nsource = Ameba::Source.new code, path\nsource.ast\n```","summary":"

Returns AST nodes constructed by Crystal::Parser.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L59"},"def":{"name":"ast","return_type":"Crystal::ASTNode","visibility":"Public","body":"if (value = @ast).nil?\n @ast = ((Crystal::Parser.new(code)).tap(&.wants_doc = true).tap(&.filename = path).parse)\nelse\n value\nend"}},{"html_id":"code:String-instance-method","name":"code","doc":"Crystal code (content of a source file).","summary":"

Crystal code (content of a source file).

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L12"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct?-instance-method","name":"correct?","doc":"Corrects any correctable issues and updates `code`.\nReturns `false` if no issues were corrected.","summary":"

Corrects any correctable issues and updates #code.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L27"},"def":{"name":"correct?","visibility":"Public","body":"corrector = Corrector.new(code)\nissues.each(&.correct(corrector))\ncorrected_code = corrector.process\nif code == corrected_code\n return false\nend\n@code = corrected_code\n@lines = nil\n@ast = nil\ntrue\n"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L66"},"def":{"name":"fullpath","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 split 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```","summary":"

Returns lines of code split by new line character.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L51"},"def":{"name":"lines","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` otherwise.","summary":"

Returns true if filepath matches the source's path, false otherwise.

","abstract":false,"args":[{"name":"filepath","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/ameba/source.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L76"},"def":{"name":"matches_path?","args":[{"name":"filepath","external_name":"filepath","restriction":""}],"visibility":"Public","body":"fullpath == (File.expand_path(filepath))"}},{"html_id":"path:String-instance-method","name":"path","doc":"Path to the source file.","summary":"

Path to the source file.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L9"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"pos(location:Crystal::Location,endend_pos=false):Int32-instance-method","name":"pos","doc":"Converts an AST location to a string position.","summary":"

Converts an AST location to a string position.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"args_string":"(location : Crystal::Location, end end_pos = false) : Int32","args_html":"(location : Crystal::Location, end end_pos = false) : Int32","location":{"filename":"src/ameba/source.cr","line_number":81,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L81"},"def":{"name":"pos","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"return_type":"Int32","visibility":"Public","body":"line, column = location.line_number, location.column_number\npos = ((lines[0...(line - 1)].sum(&.size) + line) + column) - 2\nif end_pos\n pos = pos + 1\nend\npos\n"}},{"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.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source.cr#L71"},"def":{"name":"spec?","visibility":"Public","body":"path.ends_with?(\"_spec.cr\")"}}],"types":[{"html_id":"ameba/Ameba/Source/Corrector","path":"Ameba/Source/Corrector.html","kind":"class","full_name":"Ameba::Source::Corrector","name":"Corrector","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/source/corrector.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class takes source code and rewrites it based\non the different correction actions supplied.","summary":"

This class takes source code and rewrites it based on the different correction actions supplied.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/corrector.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L9"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"insert_after(location,end_location,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(location, end_location, nil, content)`","summary":"

Shortcut for #wrap(location, end_location, nil, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L65"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_after(range:Range(Int32,Int32),content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(range, nil, content)`","summary":"

Shortcut for #wrap(range, nil, content)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L70"},"def":{"name":"insert_after","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_after(begin_pos, end_pos, content)\n"}},{"html_id":"insert_after(pos:Int32,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(...pos, content)`","summary":"

Shortcut for #insert_after(...pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L92"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(pos, content)"}},{"html_id":"insert_after(node:Crystal::ASTNode,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(node, nil, content)`","summary":"

Shortcut for #wrap(node, nil, content)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":164,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L164"},"def":{"name":"insert_after","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(end_location(node), content)"}},{"html_id":"insert_after(location,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(location, location, content)`","summary":"

Shortcut for #insert_after(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L87"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after((loc_to_pos(location)) + 1, content)"}},{"html_id":"insert_before(location,end_location,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(location, end_location, content, nil)`","summary":"

Shortcut for #wrap(location, end_location, content, nil)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L53"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_before(range:Range(Int32,Int32),content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(range, content, nil)`","summary":"

Shortcut for #wrap(range, content, nil)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L58"},"def":{"name":"insert_before","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_before(begin_pos, end_pos, content)\n"}},{"html_id":"insert_before(pos:Int32,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos.., content)`","summary":"

Shortcut for #insert_before(pos.., content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":82,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L82"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(pos, content)"}},{"html_id":"insert_before(node:Crystal::ASTNode,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(node, content, nil)`","summary":"

Shortcut for #wrap(node, content, nil)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":159,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L159"},"def":{"name":"insert_before","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(location(node), content)"}},{"html_id":"insert_before(location,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(location, location, content)`","summary":"

Shortcut for #insert_before(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L77"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/corrector.cr","line_number":196,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L196"},"def":{"name":"process","visibility":"Public","body":"@rewriter.process"}},{"html_id":"remove(location,end_location)-instance-method","name":"remove","doc":"Shortcut for `replace(location, end_location, \"\")`","summary":"

Shortcut for #replace(location, end_location, "")

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"args_string":"(location, end_location)","args_html":"(location, end_location)","location":{"filename":"src/ameba/source/corrector.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L41"},"def":{"name":"remove","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove(range:Range(Int32,Int32))-instance-method","name":"remove","doc":"Shortcut for `replace(range, \"\")`","summary":"

Shortcut for #replace(range, "")

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"args_string":"(range : Range(Int32, Int32))","args_html":"(range : Range(Int32, Int32))","location":{"filename":"src/ameba/source/corrector.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L46"},"def":{"name":"remove","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(begin_pos, end_pos)\n"}},{"html_id":"remove(node:Crystal::ASTNode)-instance-method","name":"remove","doc":"Shortcut for `replace(node, \"\")`","summary":"

Shortcut for #replace(node, "")

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/source/corrector.cr","line_number":154,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L154"},"def":{"name":"remove","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"remove(location(node), end_location(node))"}},{"html_id":"remove_leading(location,end_location,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L110"},"def":{"name":"remove_leading","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(location)) + size)"}},{"html_id":"remove_leading(range:Range(Int32,Int32),size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L115"},"def":{"name":"remove_leading","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos, begin_pos + size)\n"}},{"html_id":"remove_leading(node:Crystal::ASTNode,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the end of the node.","summary":"

Removes size characters from the beginning of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":176,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L176"},"def":{"name":"remove_leading","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_leading(location(node), end_location(node), size)"}},{"html_id":"remove_preceding(location,end_location,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L97"},"def":{"name":"remove_preceding","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove((loc_to_pos(location)) - size, loc_to_pos(location))"}},{"html_id":"remove_preceding(range:Range(Int32,Int32),size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L102"},"def":{"name":"remove_preceding","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos - size, begin_pos)\n"}},{"html_id":"remove_preceding(node:Crystal::ASTNode,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the given node.","summary":"

Removes size characters prior to the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":169,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L169"},"def":{"name":"remove_preceding","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_preceding(location(node), end_location(node), size)"}},{"html_id":"remove_trailing(location,end_location,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":123,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L123"},"def":{"name":"remove_trailing","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(((loc_to_pos(end_location)) + 1) - size, (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove_trailing(range:Range(Int32,Int32),size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":128,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L128"},"def":{"name":"remove_trailing","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"end_pos = range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(end_pos - size, end_pos)\n"}},{"html_id":"remove_trailing(node:Crystal::ASTNode,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the beginning of the node.","summary":"

Removes size characters from the end of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L183"},"def":{"name":"remove_trailing","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_trailing(location(node), end_location(node), size)"}},{"html_id":"replace(location,end_location,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L17"},"def":{"name":"replace","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.replace(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"replace(range:Range(Int32,Int32),content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L22"},"def":{"name":"replace","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.replace(begin_pos, end_pos, content)\n"}},{"html_id":"replace(node:Crystal::ASTNode,content)-instance-method","name":"replace","doc":"Replaces the code of the given node with *content*.","summary":"

Replaces the code of the given node with content.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":144,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L144"},"def":{"name":"replace","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"replace(location(node), end_location(node), content)"}},{"html_id":"wrap(location,end_location,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(location, end_location, insert_before, insert_after)","args_html":"(location, end_location, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L29"},"def":{"name":"wrap","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"@rewriter.wrap(loc_to_pos(location), (loc_to_pos(end_location)) + 1, insert_before, insert_after)"}},{"html_id":"wrap(range:Range(Int32,Int32),insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(range : Range(Int32, Int32), insert_before, insert_after)","args_html":"(range : Range(Int32, Int32), insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L34"},"def":{"name":"wrap","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.wrap(begin_pos, end_pos, insert_before, insert_after)\n"}},{"html_id":"wrap(node:Crystal::ASTNode,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given node.","summary":"

Inserts the given strings before and after the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(node : Crystal::ASTNode, insert_before, insert_after)","args_html":"(node : Crystal::ASTNode, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":149,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/corrector.cr#L149"},"def":{"name":"wrap","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"wrap(location(node), end_location(node), insert_before, insert_after)"}}]},{"html_id":"ameba/Ameba/Source/Rewriter","path":"Ameba/Source/Rewriter.html","kind":"class","full_name":"Ameba::Source::Rewriter","name":"Rewriter","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/source/rewriter.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L61"},{"filename":"src/ameba/source/rewriter/action.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter/action.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class performs the heavy lifting in the source rewriting process.\nIt schedules code updates to be performed in the correct order.\n\nFor simple cases, the resulting source will be obvious.\n\nExamples for more complex cases follow. Assume these examples are acting on\nthe source `puts(:hello, :world)`. The methods `#wrap`, `#remove`, etc.\nreceive a range as the first two arguments; for clarity, examples below use\nEnglish sentences and a string of raw code instead.\n\n## Overlapping deletions:\n\n* remove `:hello, `\n* remove `, :world`\n\nThe overlapping ranges are merged and `:hello, :world` will be removed.\n\n## Multiple actions at the same end points:\n\nResults will always be independent of the order they were given.\nException: rewriting actions done on exactly the same range (covered next).\n\nExample:\n\n* replace `, ` by ` => `\n* wrap `:hello, :world` with `{` and `}`\n* replace `:world` with `:everybody`\n* wrap `:world` with `[`, `]`\n\nThe resulting string will be `puts({:hello => [:everybody]})`\nand this result is independent of the order the instructions were given in.\n\n## Multiple wraps on same range:\n\n* wrap `:hello` with `(` and `)`\n* wrap `:hello` with `[` and `]`\n\nThe wraps are combined in order given and results would be `puts([(:hello)], :world)`.\n\n## Multiple replacements on same range:\n\n* replace `:hello` by `:hi`, then\n* replace `:hello` by `:hey`\n\nThe replacements are made in the order given, so the latter replacement\nsupersedes the former and `:hello` will be replaced by `:hey`.\n\n## Swallowed insertions:\n\n* wrap `world` by `__`, `__`\n* replace `:hello, :world` with `:hi`\n\nA containing replacement will swallow the contained rewriting actions\nand `:hello, :world` will be replaced by `:hi`.\n\n## Implementation\n\nThe updates are organized in a tree, according to the ranges they act on\n(where children are strictly contained by their parent).","summary":"

This class performs the heavy lifting in the source rewriting process.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L64"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L62"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"empty?-instance-method","name":"empty?","doc":"Returns `true` if no (non trivial) update has been recorded","summary":"

Returns true if no (non trivial) update has been recorded

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L69"},"def":{"name":"empty?","visibility":"Public","body":"@action_root.empty?"}},{"html_id":"insert_after(begin_pos,end_pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(begin_pos, end_pos, nil, content)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, nil, content)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L97"},"def":{"name":"insert_after","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, nil, content)"}},{"html_id":"insert_after(pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(pos, pos, content)`","summary":"

Shortcut for #insert_after(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":107,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L107"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(pos, pos, content)"}},{"html_id":"insert_before(begin_pos,end_pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(begin_pos, end_pos, content, nil)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, content, nil)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L92"},"def":{"name":"insert_before","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, content, nil)"}},{"html_id":"insert_before(pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos, pos, content)`","summary":"

Shortcut for #insert_before(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L102"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(pos, pos, content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L112"},"def":{"name":"process","visibility":"Public","body":"String.build do |io|\n last_end = 0\n @action_root.ordered_replacements.each do |begin_pos, end_pos, replacement|\n (io << code[last_end...begin_pos]) << replacement\n last_end = end_pos\n end\n io << code[last_end...code.size]\nend"}},{"html_id":"remove(begin_pos,end_pos)-instance-method","name":"remove","doc":"Shortcut for `replace(begin_pos, end_pos, \"\")`","summary":"

Shortcut for #replace(begin_pos, end_pos, "")

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"args_string":"(begin_pos, end_pos)","args_html":"(begin_pos, end_pos)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L87"},"def":{"name":"remove","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"visibility":"Public","body":"replace(begin_pos, end_pos, \"\")"}},{"html_id":"replace(begin_pos,end_pos,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L74"},"def":{"name":"replace","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, replacement: content.to_s)"}},{"html_id":"wrap(begin_pos,end_pos,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(begin_pos, end_pos, insert_before, insert_after)","args_html":"(begin_pos, end_pos, insert_before, insert_after)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/source/rewriter.cr#L80"},"def":{"name":"wrap","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, insert_before: insert_before.to_s, insert_after: insert_after.to_s)"}}]}]},{"html_id":"ameba/Ameba/Spec","path":"Ameba/Spec.html","kind":"module","full_name":"Ameba::Spec","name":"Spec","abstract":false,"locations":[{"filename":"src/ameba/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L2"},{"filename":"src/ameba/spec/be_valid.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Spec/AnnotatedSource","path":"Ameba/Spec/AnnotatedSource.html","kind":"class","full_name":"Ameba::Spec::AnnotatedSource","name":"AnnotatedSource","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/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ABBREV","name":"ABBREV","value":"\"[...]\""},{"id":"ANNOTATION_PATTERN_1","name":"ANNOTATION_PATTERN_1","value":"/\\A\\s*(# )?(\\^+|\\^{})( error:)? /"},{"id":"ANNOTATION_PATTERN_2","name":"ANNOTATION_PATTERN_2","value":"\" # error: \""}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Parsed representation of code annotated with the `# ^^^ error: Message` style","summary":"

Parsed representation of code annotated with the # ^^^ error: Message style

","class_methods":[{"html_id":"parse(annotated_code)-class-method","name":"parse","doc":"Separates annotation lines from code lines. Tracks the real\ncode line number that each annotation corresponds to.","summary":"

Separates annotation lines from code lines.

","abstract":false,"args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"args_string":"(annotated_code)","args_html":"(annotated_code)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L16"},"def":{"name":"parse","args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"visibility":"Public","body":"lines = [] of String\nannotations = [] of ::Tuple(Int32, String, String)\ncode_lines = annotated_code.split('\\n')\ncode_lines.each do |code_line|\n case\n when 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 when 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\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:Array(String),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.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"args_string":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","args_html":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L43"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lines, annotations)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(lines:Array(String),issues:Enumerable(Issue))-class-method","name":"new","doc":"Annotates the source code with the Ameba issues provided.\n\nNOTE: Annotations are sorted so that reconstructing the annotation\n text via `#to_s` is deterministic.","summary":"

Annotates the source code with the Ameba issues provided.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"args_string":"(lines : Array(String), issues : Enumerable(Issue))","args_html":"(lines : Array(String), issues : Enumerable(Issue))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L53"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L59"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"(other.is_a?(AnnotatedSource) && (other.lines == lines)) && (match_annotations?(other))"}},{"html_id":"annotations:Array(Tuple(Int32,String,String))-instance-method","name":"annotations","doc":"Each entry is the line number, annotation prefix, and message.\nThe prefix is empty if the annotation is at the end of a code line.","summary":"

Each entry is the line number, annotation prefix, and message.

","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L12"},"def":{"name":"annotations","return_type":"Array(::Tuple(Int32, String, String))","visibility":"Public","body":"@annotations"}},{"html_id":"lines:Array(String)-instance-method","name":"lines","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L8"},"def":{"name":"lines","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","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/annotated_source.cr#L110"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"reconstructed = lines.dup\nannotations.reverse_each do |line_number, prefix, message|\n if prefix.empty?\n __temp_62 = line_number - 1\n reconstructed[__temp_62] = reconstructed[__temp_62] + \"#{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"}}]},{"html_id":"ameba/Ameba/Spec/BeValid","path":"Ameba/Spec/BeValid.html","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid","abstract":false,"locations":[{"filename":"src/ameba/spec/be_valid.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"instance_methods":[{"html_id":"be_valid-instance-method","name":"be_valid","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L3"},"def":{"name":"be_valid","visibility":"Public","body":"BeValidExpectation.new"}}]},{"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/e6a5fa9/src/ameba/spec/be_valid.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"new","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","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/spec/be_valid.cr#L13"},"def":{"name":"failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"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 |issue|\n str << \" * #{issue.rule.name}: #{issue.message}\\n\"\n end\nend"}},{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"initialize","visibility":"Public","body":""}},{"html_id":"match(source)-instance-method","name":"match","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/spec/be_valid.cr#L9"},"def":{"name":"match","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.valid?"}},{"html_id":"negative_failure_message(source)-instance-method","name":"negative_failure_message","abstract":false,"args":[{"name":"source","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/e6a5fa9/src/ameba/spec/be_valid.cr#L22"},"def":{"name":"negative_failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"\"Source expected to be invalid, but it is valid.\""}}]},{"html_id":"ameba/Ameba/Spec/ExpectIssue","path":"Ameba/Spec/ExpectIssue.html","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue","abstract":false,"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":96,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Mixin for `expect_issue` and `expect_no_issues`\n\nThis 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, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\nEquivalent assertion without `expect_issue`:\n\n source = Source.new <<-CRYSTAL, \"source.cr\"\n a do\n b\n end.c\n CRYSTAL\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:3:1\"\n issue.end_location.to_s.should eq \"source.cr:3:5\"\n issue.message.should eq(\n \"Avoid chaining a method call on a do...end block.\"\n )\n\nAutocorrection can be tested using `expect_correction` after\n`expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n x % 2 == 0\n # ^^^^^^^^ error: Replace with `Int#even?`.\n CRYSTAL\n\n expect_correction source, <<-CRYSTAL\n x.even?\n CRYSTAL\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.\n\nIf the code produces an issue that could not be auto-corrected, you can\nuse `expect_no_corrections` after `expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\n expect_no_corrections source\n\nIf your code has variables of different lengths, you can use `%{foo}`,\n`^{foo}`, and `_{foo}` to format your template; you can also abbreviate\nissue messages with `[...]`:\n\n %w[raise fail].each do |keyword|\n expect_issue subject, <<-CRYSTAL, keyword: keyword\n %{keyword} Exception.new(msg)\n # ^{keyword}^^^^^^^^^^^^^^^^^ error: Redundant `Exception.new` [...]\n CRYSTAL\n\n %w[has_one has_many].each do |type|\n expect_issue subject, <<-CRYSTAL, type: type\n class Book\n %{type} :chapter, foreign_key: \"book_id\"\n _{type} # ^^^^^^^^^^^^^^^^^^^^^^ error: Specifying the default [...]\n end\n CRYSTAL\n end\n\nIf you need to specify an issue on a blank line, use the empty `^{}` marker:\n\n expect_issue subject, <<-CRYSTAL\n\n # ^{} error: Missing frozen string literal comment.\n puts 1\n CRYSTAL","summary":"

Mixin for #expect_issue and #expect_no_issues

","instance_methods":[{"html_id":"expect_correction(source,correction,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_correction","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, correction, *, file = __FILE__, line = __LINE__)","args_html":"(source, correction, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":131,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L131"},"def":{"name":"expect_correction","args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":2,"visibility":"Public","body":"if source.correct?\nelse\n raise(\"Use `expect_no_corrections` if the code will not change\")\nend\nif correction == source.code\n return\nend\nfail(\"Expected correction:\\n\\n#{correction}\\n\\nGot:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_issue(rules:Rule::Base|Enumerable(Rule::Base),annotated_code:String,path=\"\",*,file=__FILE__,line=__LINE__,**replacements)-instance-method","name":"expect_issue","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = \"\", *, file = __FILE__, line = __LINE__, **replacements)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = "", *, file = __FILE__, line = __LINE__, **replacements)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L99"},"def":{"name":"expect_issue","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":{"name":"replacements","external_name":"replacements","restriction":""},"splat_index":3,"visibility":"Public","body":"annotated_code = format_issue(annotated_code, **replacements)\nexpected_annotations = AnnotatedSource.parse(annotated_code)\nlines = expected_annotations.lines\ncode = lines.join('\\n')\nif code == annotated_code\n raise(\"Use `expect_no_issues` to assert that no issues are found\")\nend\nsource, actual_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\nsource\n"}},{"html_id":"expect_no_corrections(source,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_corrections","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, *, file = __FILE__, line = __LINE__)","args_html":"(source, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L146"},"def":{"name":"expect_no_corrections","args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":1,"visibility":"Public","body":"if source.correct?\nelse\n return\nend\nfail(\"Expected no corrections, but got:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_no_issues(rules:Rule::Base|Enumerable(Rule::Base),code:String,path=\"\",*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_issues","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = \"\", *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = "", *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/expect_issue.cr#L156"},"def":{"name":"expect_no_issues","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":3,"visibility":"Public","body":"lines = code.split('\\n')\n_, actual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations.to_s == code\n return\nend\nfail(\"Expected no issues, but got:\\n\\n#{actual_annotations}\", file, line)\n"}}]},{"html_id":"ameba/Ameba/Spec/Util","path":"Ameba/Spec/Util.html","kind":"module","full_name":"Ameba::Spec::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/spec/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/spec/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"},"instance_methods":[{"html_id":"normalize_code(code,separator='\\n')-instance-method","name":"normalize_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","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/e6a5fa9/src/ameba/spec/util.cr#L2"},"def":{"name":"normalize_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","default_value":"'\\n'","external_name":"separator","restriction":""}],"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"}}]}]},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

Represents Crystal syntax tokenizer based on Crystal::Lexer.

","constructors":[{"html_id":"new(lexer:Crystal::Lexer)-class-method","name":"new","doc":"Instantiates Tokenizer using a `lexer`.\n\n```\nlexer = Crystal::Lexer.new(code)\nAmeba::Tokenizer.new(lexer)\n```","summary":"

Instantiates Tokenizer using a lexer.

","abstract":false,"args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"args_string":"(lexer : Crystal::Lexer)","args_html":"(lexer : Crystal::Lexer)","location":{"filename":"src/ameba/tokenizer.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L34"},"def":{"name":"new","args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lexer)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(source)-class-method","name":"new","doc":"Instantiates Tokenizer using a `source`.\n\n```\nsource = Ameba::Source.new code, path\nAmeba::Tokenizer.new(source)\n```","summary":"

Instantiates Tokenizer using a source.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/tokenizer.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L20"},"def":{"name":"new","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"run(&block:Crystal::Token->_)-instance-method","name":"run","doc":"Runs the tokenizer and yields each token as a block argument.\n\n```\nAmeba::Tokenizer.new(source).run do |token|\n puts token\nend\n```","summary":"

Runs the tokenizer and yields each token as a block argument.

","abstract":false,"location":{"filename":"src/ameba/tokenizer.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/e6a5fa9/src/ameba/tokenizer.cr#L44"},"def":{"name":"run","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crystal::Token -> _)"},"visibility":"Public","body":"begin\n run_normal_state(@lexer, &block)\n true\nrescue e : Crystal::SyntaxException\n false\nend"}}]}]}]}}) \ No newline at end of file +crystal_doc_search_index_callback({"repository_name":"ameba","body":"

\n \n

Ameba

\n

Code style linter for Crystal

\n

\n \n (a single-celled animal that catches food and moves about by extending fingerlike projections of protoplasm)\n \n

\n

\n \n \n \n

\n

\n\n- [About](#about)\n- [Usage](#usage)\n - [Watch a tutorial](#watch-a-tutorial)\n - [Autocorrection](#autocorrection)\n - [Explain issues](#explain-issues)\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 - [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.....................FF....................................................................\n\nsrc/ameba/formatter/flycheck_formatter.cr:6:37\n[W] Lint/UnusedArgument: Unused argument `location`. If it's necessary, use `_` as an argument name to indicate that it won't be used.\n> source.issues.each do |issue, location|\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:14\n[W] Lint/UselessAssign: Useless assignment to variable `s`\n> return s += issues.size\n ^\n\nsrc/ameba/formatter/base_formatter.cr:16:7 [Correctable]\n[C] Style/RedundantReturn: Redundant `return` detected\n> return s += issues.size\n ^---------------------^\n\nFinished in 389.45 milliseconds\n107 inspected, 3 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### Autocorrection\n\nRules that are marked as `[Correctable]` in the output can be automatically corrected using `--fix` flag:\n\n```sh\n$ ameba --fix\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### Run in parallel\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```\n\nBuild `bin/ameba` binary within your project directory while running `shards install`.\n\n### OS X\n\n```sh\n$ brew tap crystal-ameba/ameba\n$ brew install ameba\n```\n\n### Docker\n\nBuild the image:\n\n```sh\n$ docker build -t ghcr.io/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 ghcr.io/crystal-ameba/ameba\n```\n\nAlso available on GitHub: https://github.com/crystal-ameba/ameba/pkgs/container/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### 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\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- [Sija](https://github.com/Sija) Sijawusz Pur Rahnama - contributor, maintainer\n","program":{"html_id":"ameba/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"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,"const":false,"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"}],"types":[{"html_id":"ameba/Ameba","path":"Ameba.html","kind":"module","full_name":"Ameba","name":"Ameba","abstract":false,"locations":[{"filename":"src/ameba.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba.cr#L26"},{"filename":"src/ameba/glob_utils.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L1"},{"filename":"src/ameba/inline_comments.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L1"},{"filename":"src/ameba/issue.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L1"},{"filename":"src/ameba/reportable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L3"},{"filename":"src/ameba/runner.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L1"},{"filename":"src/ameba/severity.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L3"},{"filename":"src/ameba/source.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/support.cr#L7"},{"filename":"src/ameba/tokenizer.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"VERSION","name":"VERSION","value":"{{ (`shards version \\\"/home/runner/work/ameba/ameba/src\\\"`).chomp.stringify }}"}],"extended_modules":[{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"}],"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.

","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.

","abstract":false,"args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"args_string":"(config = Config.load)","args_html":"(config = Config.load)","location":{"filename":"src/ameba.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba.cr#L40"},"def":{"name":"run","args":[{"name":"config","default_value":"Config.load","external_name":"config","restriction":""}],"visibility":"Public","body":"(Runner.new(config)).run"}}],"types":[{"html_id":"ameba/Ameba/AST","path":"Ameba/AST.html","kind":"module","full_name":"Ameba::AST","name":"AST","abstract":false,"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L3"},{"filename":"src/ameba/ast/branchable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L3"},{"filename":"src/ameba/ast/flow_expression.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L3"},{"filename":"src/ameba/ast/scope.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L3"},{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L2"},{"filename":"src/ameba/ast/variabling/argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L1"},{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L4"},{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/ivariable.cr#L1"},{"filename":"src/ameba/ast/variabling/reference.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/reference.cr#L3"},{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L1"},{"filename":"src/ameba/ast/variabling/variable.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L1"},{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/flow_expression_visitor.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/flow_expression_visitor.cr#L4"},{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L1"},{"filename":"src/ameba/ast/visitors/scope_visitor.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/scope_visitor.cr#L3"},{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","types":[{"html_id":"ameba/Ameba/AST/Argument","path":"Ameba/AST/Argument.html","kind":"class","full_name":"Ameba::AST::Argument","name":"Argument","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/variabling/argument.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the argument of some node.\nHolds the reference to the variable, thus to scope.\n\nFor example, all these vars are arguments:\n\n```\ndef method(a, b, c = 10, &block)\n 3.times do |i|\n end\n\n ->(x : Int32) {}\nend\n```","summary":"

Represents the argument of some node.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable)","location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"}],"visibility":"Public","body":"_ = allocate\n_.initialize(node, variable)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"anonymous?-instance-method","name":"anonymous?","doc":"Returns `true` if the `name` is empty, `false` otherwise.","summary":"

Returns true if the #name is empty, false otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L34"},"def":{"name":"anonymous?","visibility":"Public","body":"name.blank?"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L39"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L44"},"def":{"name":"name","visibility":"Public","body":"case current_node = node\nwhen Crystal::Var, 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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L17"},"def":{"name":"node","return_type":"Crystal::Var | Crystal::Arg","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/argument.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/argument.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/argument.cr#L20"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/6d03cef/src/ameba/ast/variabling/assignment.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,variable:Ameba::AST::Variable,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::ASTNode, variable : Ameba::AST::Variable, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L30"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"variable","external_name":"variable","restriction":"::Ameba::AST::Variable"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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|Nil-instance-method","name":"branch","doc":"Branch of this assignment.","summary":"

Branch of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L17"},"def":{"name":"branch","return_type":"Branch | ::Nil","visibility":"Public","body":"@branch"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L57"},"def":{"name":"in_branch?","visibility":"Public","body":"!branch.nil?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L11"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L47"},"def":{"name":"op_assign?","visibility":"Public","body":"node.is_a?(Crystal::OpAssign)"}},{"html_id":"referenced=(referenced:Bool)-instance-method","name":"referenced=","abstract":false,"args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"args_string":"(referenced : Bool)","args_html":"(referenced : Bool)","location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced=","args":[{"name":"referenced","external_name":"referenced","restriction":"::Bool"}],"visibility":"Public","body":"@referenced = referenced"}},{"html_id":"referenced?:Bool-instance-method","name":"referenced?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L8"},"def":{"name":"referenced?","visibility":"Public","body":"@referenced"}},{"html_id":"referenced_in_loop?-instance-method","name":"referenced_in_loop?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L37"},"def":{"name":"referenced_in_loop?","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L20"},"def":{"name":"scope","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,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L62"},"def":{"name":"target_node","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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/assignment.cr#L22"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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 assignment.","summary":"

Variable of this assignment.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/assignment.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/assignment.cr#L14"},"def":{"name":"variable","return_type":"Variable","visibility":"Public","body":"@variable"}}]},{"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/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::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","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L18"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/base_visitor.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/base_visitor.cr#L24"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"true"}}]},{"html_id":"ameba/Ameba/AST/Branch","path":"Ameba/AST/Branch.html","kind":"class","full_name":"Ameba::AST::Branch","name":"Branch","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/branch.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"Represents the branch in Crystal code.\nBranch is a part of a branchable statement.\nFor example, the branchable if statement contains 3 branches:\n\n```\nif a = something # --> Branch A\n a = 1 # --> Branch B\n put a if out # --> Branch C\nelse\n do_something a # --> Branch D\nend\n```","summary":"

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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode, parent_node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/branch.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L66"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"parent_node","external_name":"parent_node","restriction":"Crystal::ASTNode"}],"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","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(node : Crystal::ASTNode, scope : Scope)","args_html":"(node : Crystal::ASTNode, scope : Scope)","location":{"filename":"src/ameba/ast/branch.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L57"},"def":{"name":"of","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"of(node, scope.node)"}}],"constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Ameba::AST::Branchable)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","args_html":"(node : Crystal::ASTNode, parent : Ameba::AST::Branchable)","location":{"filename":"src/ameba/ast/branch.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L34"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","external_name":"parent","restriction":"::Ameba::AST::Branchable"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L25"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_loop?-instance-method","name":"in_loop?","doc":"Returns `true` if current branch is in a loop, `false` - otherwise.\nFor example, this branch is in a loop:\n\n```\nwhile true\n handle_input # this branch is in a loop\n if wrong_input\n show_message # this branch is also in a loop.\n end\nend\n```","summary":"

Returns true if current branch is in a loop, false - otherwise.

","abstract":false,"location":{"filename":"src/ameba/ast/branch.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L48"},"def":{"name":"in_loop?","visibility":"Public","body":"@parent.loop?"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branch.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L24"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L18"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/branch.cr","line_number":21,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branch.cr#L21"},"def":{"name":"parent","return_type":"Branchable","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branch.cr#L23"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/6d03cef/src/ameba/ast/branchable.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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```\nwhile 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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,parent:Nil|Ameba::AST::Branchable=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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"args_string":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","args_html":"(node : Crystal::ASTNode, parent : Nil | Ameba::AST::Branchable = nil)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"parent","default_value":"nil","external_name":"parent","restriction":"::Nil | ::Ameba::AST::Branchable"}],"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":"Array of branches","summary":"

Array of branches

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L22"},"def":{"name":"branches","visibility":"Public","body":"@branches"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/branchable.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L41"},"def":{"name":"loop?","visibility":"Public","body":"(loop?(node)) || (!(!parent.try(&.loop?)))"}},{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"The actual Crystal node","summary":"

The actual Crystal node

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"parent:Branchable|Nil-instance-method","name":"parent","doc":"Parent branchable (if any)","summary":"

Parent branchable (if any)

","abstract":false,"location":{"filename":"src/ameba/ast/branchable.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/branchable.cr#L19"},"def":{"name":"parent","return_type":"Branchable | ::Nil","visibility":"Public","body":"@parent"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/branchable.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"DEFAULT_COMPLEXITY","name":"DEFAULT_COMPLEXITY","value":"1"}],"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

","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","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L9"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L19"},"def":{"name":"count","visibility":"Public","body":"@scope.accept(self)\n@complexity\n"}},{"html_id":"macro_condition?:Bool-instance-method","name":"macro_condition?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/counting_visitor.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L6"},"def":{"name":"macro_condition?","visibility":"Public","body":"@macro_condition"}},{"html_id":"visit(node:Crystal::MacroIf|Crystal::MacroFor)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","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":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/counting_visitor.cr#L45"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MacroIf | Crystal::MacroFor"}],"visibility":"Public","body":"@macro_condition = true\n@complexity = DEFAULT_COMPLEXITY\nfalse\n"}}]},{"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/6d03cef/src/ameba/ast/flow_expression.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,in_loop:Bool)-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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"args_string":"(node : Crystal::ASTNode, in_loop : Bool)","args_html":"(node : Crystal::ASTNode, in_loop : Bool)","location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L36"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"in_loop","external_name":"in_loop","restriction":"::Bool"}],"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L29"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L22"},"def":{"name":"in_loop?","return_type":"Bool","visibility":"Public","body":"@in_loop"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L28"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L25"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/flow_expression.cr#L27"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/flow_expression.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/flow_expression.cr#L50"},"def":{"name":"unreachable_nodes","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 = (!(loop?(exp))) && (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"}}]},{"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/6d03cef/src/ameba/ast/visitors/flow_expression_visitor.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

"},{"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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::InstanceVar)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/ivariable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::InstanceVar"}],"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.name(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"node:Crystal::InstanceVar-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/ivariable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/ivariable.cr#L3"},"def":{"name":"node","return_type":"Crystal::InstanceVar","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/ivariable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"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":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{Alias, Assign, Block, Call, Case, ClassDef, ClassVar, Def, EnumDef, ExceptionHandler, Expressions, HashLiteral, If, InstanceVar, IsA, LibDef, ModuleDef, MultiAssign, NilLiteral, StringInterpolation, Unless, Until, Var, When, While}","doc":"List of nodes to be visited by Ameba's rules.","summary":"

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

"}],"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```","summary":"

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

","class_methods":[{"html_id":"category_to_node_classes(category:Category)-class-method","name":"category_to_node_classes","abstract":false,"args":[{"name":"category","external_name":"category","restriction":"Category"}],"args_string":"(category : Category)","args_html":"(category : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L47"},"def":{"name":"category_to_node_classes","args":[{"name":"category","external_name":"category","restriction":"Category"}],"visibility":"Public","body":"([] of Crystal::ASTNode.class).tap do |classes|\n if category.macro?\n classes.push(Crystal::Macro, Crystal::MacroExpression, Crystal::MacroIf, Crystal::MacroFor)\n end\nend"}}],"constructors":[{"html_id":"new(rule,source,*,skip:Category)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"args_string":"(rule, source, *, skip : Category)","args_html":"(rule, source, *, skip : Category)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L58"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","external_name":"skip","restriction":"Category"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(rule,source,*,skip:Array|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"args_string":"(rule, source, *, skip : Array | Nil = nil)","args_html":"(rule, source, *, skip : Array | Nil = nil)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L63"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":"Array | ::Nil"}],"splat_index":2,"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip: skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"visit(node:Crystal::VisibilityModifier)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"args_string":"(node : Crystal::VisibilityModifier)","args_html":"(node : Crystal::VisibilityModifier)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L68"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::VisibilityModifier"}],"visibility":"Public","body":"node.exp.visibility = node.modifier\ntrue\n"}},{"html_id":"visit(node:Crystal::Alias)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Alias` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Alias node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"args_string":"(node : Crystal::Alias)","args_html":"(node : Crystal::Alias)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Alias"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Assign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Assign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Assign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(node : Crystal::Assign)","args_html":"(node : Crystal::Assign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Block)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Block` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Block node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"args_string":"(node : Crystal::Block)","args_html":"(node : Crystal::Block)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Call)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Call` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Call node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(node : Crystal::Call)","args_html":"(node : Crystal::Call)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Case)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Case` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Case node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"args_string":"(node : Crystal::Case)","args_html":"(node : Crystal::Case)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Case"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"args_string":"(node : Crystal::ClassDef)","args_html":"(node : Crystal::ClassDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ClassVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ClassVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ClassVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"args_string":"(node : Crystal::ClassVar)","args_html":"(node : Crystal::ClassVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ClassVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Def)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Def` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Def node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(node : Crystal::Def)","args_html":"(node : Crystal::Def)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::EnumDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::EnumDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::EnumDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"args_string":"(node : Crystal::EnumDef)","args_html":"(node : Crystal::EnumDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ExceptionHandler)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ExceptionHandler` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ExceptionHandler node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(node : Crystal::ExceptionHandler)","args_html":"(node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Expressions` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Expressions node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"args_string":"(node : Crystal::Expressions)","args_html":"(node : Crystal::Expressions)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::HashLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::HashLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::HashLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"args_string":"(node : Crystal::HashLiteral)","args_html":"(node : Crystal::HashLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::If)-instance-method","name":"visit","doc":"A visit callback for `Crystal::If` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::If node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"args_string":"(node : Crystal::If)","args_html":"(node : Crystal::If)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::If"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::InstanceVar)-instance-method","name":"visit","doc":"A visit callback for `Crystal::InstanceVar` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::InstanceVar node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"args_string":"(node : Crystal::InstanceVar)","args_html":"(node : Crystal::InstanceVar)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::InstanceVar"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::IsA)-instance-method","name":"visit","doc":"A visit callback for `Crystal::IsA` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::IsA node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(node : Crystal::IsA)","args_html":"(node : Crystal::IsA)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::LibDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::LibDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::LibDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"args_string":"(node : Crystal::LibDef)","args_html":"(node : Crystal::LibDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::LibDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::ModuleDef)-instance-method","name":"visit","doc":"A visit callback for `Crystal::ModuleDef` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::ModuleDef node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"args_string":"(node : Crystal::ModuleDef)","args_html":"(node : Crystal::ModuleDef)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::MultiAssign)-instance-method","name":"visit","doc":"A visit callback for `Crystal::MultiAssign` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::MultiAssign node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(node : Crystal::MultiAssign)","args_html":"(node : Crystal::MultiAssign)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::NilLiteral)-instance-method","name":"visit","doc":"A visit callback for `Crystal::NilLiteral` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::NilLiteral node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"args_string":"(node : Crystal::NilLiteral)","args_html":"(node : Crystal::NilLiteral)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::NilLiteral"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::StringInterpolation)-instance-method","name":"visit","doc":"A visit callback for `Crystal::StringInterpolation` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::StringInterpolation node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"args_string":"(node : Crystal::StringInterpolation)","args_html":"(node : Crystal::StringInterpolation)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Unless)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Unless` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Unless node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(node : Crystal::Unless)","args_html":"(node : Crystal::Unless)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Until)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Until` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Until node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"args_string":"(node : Crystal::Until)","args_html":"(node : Crystal::Until)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Until"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::Var)-instance-method","name":"visit","doc":"A visit callback for `Crystal::Var` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::Var node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"args_string":"(node : Crystal::Var)","args_html":"(node : Crystal::Var)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::When)-instance-method","name":"visit","doc":"A visit callback for `Crystal::When` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::When node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"args_string":"(node : Crystal::When)","args_html":"(node : Crystal::When)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node:Crystal::While)-instance-method","name":"visit","doc":"A visit callback for `Crystal::While` node.\n\nReturns `true` if the child nodes should be traversed as well,\n`false` otherwise.","summary":"

A visit callback for Crystal::While node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(node : Crystal::While)","args_html":"(node : Crystal::While)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":73,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L73"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if skip?(node)\n return false\nend\n@rule.test(@source, node)\ntrue\n"}},{"html_id":"visit(node)-instance-method","name":"visit","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":86,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L86"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"!(skip?(node))"}}],"types":[{"html_id":"ameba/Ameba/AST/NodeVisitor/Category","path":"Ameba/AST/NodeVisitor/Category.html","kind":"enum","full_name":"Ameba::AST::NodeVisitor::Category","name":"Category","abstract":false,"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/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L12"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Macro","name":"Macro","value":"1"},{"id":"None","name":"None","value":"0"},{"id":"All","name":"All","value":"1"}],"namespace":{"html_id":"ameba/Ameba/AST/NodeVisitor","kind":"class","full_name":"Ameba::AST::NodeVisitor","name":"NodeVisitor"},"instance_methods":[{"html_id":"macro?-instance-method","name":"macro?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L13"},"def":{"name":"macro?","visibility":"Public","body":"self.includes?(Macro)"}},{"html_id":"none?-instance-method","name":"none?","abstract":false,"location":{"filename":"src/ameba/ast/visitors/node_visitor.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/node_visitor.cr#L12"},"def":{"name":"none?","visibility":"Public","body":"value == 0"}}]}]},{"html_id":"ameba/Ameba/AST/RedundantControlExpressionVisitor","path":"Ameba/AST/RedundantControlExpressionVisitor.html","kind":"class","full_name":"Ameba::AST::RedundantControlExpressionVisitor","name":"RedundantControlExpressionVisitor","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"doc":"A class that utilizes a logic to traverse AST nodes and\nfire a source test callback if a redundant `Crystal::ControlExpression`\nis reached.","summary":"

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

","constructors":[{"html_id":"new(rule:Ameba::Rule::Base,source:Ameba::Source,node:Crystal::ASTNode)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"args_string":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","args_html":"(rule : Ameba::Rule::Base, source : Ameba::Source, node : Crystal::ASTNode)","location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L15"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"source","external_name":"source","restriction":"::Ameba::Source"},{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, node)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"node:Crystal::ASTNode-instance-method","name":"node","doc":"A node to run traversal on.","summary":"

A node to run traversal on.

","abstract":false,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L13"},"def":{"name":"node","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L7"},"def":{"name":"rule","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,"location":{"filename":"src/ameba/ast/visitors/redundant_control_expression_visitor.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/redundant_control_expression_visitor.cr#L10"},"def":{"name":"source","return_type":"Source","visibility":"Public","body":"@source"}}]},{"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/6d03cef/src/ameba/ast/variabling/reference.cr#L7"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","instance_methods":[{"html_id":"explicit=(explicit:Bool)-instance-method","name":"explicit=","abstract":false,"args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"args_string":"(explicit : Bool)","args_html":"(explicit : Bool)","location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit=","args":[{"name":"explicit","external_name":"explicit","restriction":"::Bool"}],"visibility":"Public","body":"@explicit = explicit"}},{"html_id":"explicit?:Bool-instance-method","name":"explicit?","abstract":false,"location":{"filename":"src/ameba/ast/variabling/reference.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/reference.cr#L8"},"def":{"name":"explicit?","visibility":"Public","body":"@explicit"}}]},{"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/6d03cef/src/ameba/ast/scope.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(node:Crystal::ASTNode,outer_scope:Nil|Ameba::AST::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","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"args_string":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","args_html":"(node : Crystal::ASTNode, outer_scope : Nil | Ameba::AST::Scope = nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L47"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::ASTNode"},{"name":"outer_scope","default_value":"nil","external_name":"outer_scope","restriction":"::Nil | ::Ameba::AST::Scope"}],"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.

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":"self"}],"args_string":"(other : self)","args_html":"(other : self)","def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":"self"}],"visibility":"Public","body":"if same?(other)\n return true\nend\nif node == other.node\nelse\n return false\nend\nif location == other.location\nelse\n return false\nend\ntrue\n"}},{"html_id":"add_argument(node)-instance-method","name":"add_argument","doc":"Creates a new argument in the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_argument(arg_node)\n```","summary":"

Creates a new argument in the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L67"},"def":{"name":"add_argument","args":[{"name":"node","external_name":"node","restriction":""}],"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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L78"},"def":{"name":"add_ivariable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"ivariables << (InstanceVariable.new(node))"}},{"html_id":"add_type_dec_variable(node)-instance-method","name":"add_type_dec_variable","doc":"Adds a new type declaration variable to the current scope.\n\n```\nscope = Scope.new(class_node, nil)\nscope.add_type_dec_variable(node)\n```","summary":"

Adds a new type declaration variable to the current scope.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":88,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L88"},"def":{"name":"add_type_dec_variable","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"type_dec_variables << (TypeDecVariable.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","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":57,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L57"},"def":{"name":"add_variable","args":[{"name":"node","external_name":"node","restriction":""}],"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` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"var","external_name":"var","restriction":""}],"args_string":"(var)","args_html":"(var)","location":{"filename":"src/ameba/ast/scope.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L199"},"def":{"name":"arg?","args":[{"name":"var","external_name":"var","restriction":""}],"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L20"},"def":{"name":"arguments","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","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"args_string":"(name, node)","args_html":"(name, node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":109,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L109"},"def":{"name":"assign_variable","args":[{"name":"name","external_name":"name","restriction":""},{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(find_variable(name)).try(&.assign(node, self))"}},{"html_id":"assigns_ivar?(name)-instance-method","name":"assigns_ivar?","doc":"Returns `true` if instance variable is assigned in this scope.","summary":"

Returns true if instance variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":140,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L140"},"def":{"name":"assigns_ivar?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"arguments.any?() do |__arg7|\n __arg7.name == name\nend && ivariables.any?() do |__arg8|\n __arg8.name == \"@#{name}\"\nend"}},{"html_id":"assigns_type_dec?(name)-instance-method","name":"assigns_type_dec?","doc":"Returns `true` if type declaration variable is assigned in this scope.","summary":"

Returns true if type declaration variable is assigned in this scope.

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":""}],"args_string":"(name)","args_html":"(name)","location":{"filename":"src/ameba/ast/scope.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L146"},"def":{"name":"assigns_type_dec?","args":[{"name":"name","external_name":"name","restriction":""}],"visibility":"Public","body":"type_dec_variables.any?() do |__arg9|\n __arg9.name == name\nend || (!(!outer_scope.try(&.assigns_type_dec?(name))))"}},{"html_id":"block?-instance-method","name":"block?","doc":"Returns `true` if current scope represents a block (or proc),\n`false` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L115"},"def":{"name":"block?","visibility":"Public","body":"node.is_a?(Crystal::Block) || node.is_a?(Crystal::ProcLiteral)"}},{"html_id":"class_def?(*,check_outer_scopes=false)-instance-method","name":"class_def?","doc":"Returns `true` if current scope is a class def, `false` otherwise.","summary":"

Returns true if current scope is a class def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"class_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ClassDef) || (!(!(check_outer_scopes && outer_scope.try(&.class_def?(check_outer_scopes: true)))))"}},{"html_id":"def?(*,check_outer_scopes=false)-instance-method","name":"def?","doc":"Returns `true` if current scope is a def, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::Def) || (!(!(check_outer_scopes && outer_scope.try(&.def?(check_outer_scopes: true)))))"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.end_location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enum_def?(*,check_outer_scopes=false)-instance-method","name":"enum_def?","doc":"Returns `true` if current scope is a enum def, `false` otherwise.","summary":"

Returns true if current scope is a enum def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"enum_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::EnumDef) || (!(!(check_outer_scopes && outer_scope.try(&.enum_def?(check_outer_scopes: true)))))"}},{"html_id":"eql?(node)-instance-method","name":"eql?","doc":"Returns `true` if the *node* represents exactly\nthe same Crystal node as `@node`.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/scope.cr","line_number":218,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L218"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node == @node) && node.location) && (node.location == @node.location)"}},{"html_id":"find_variable(name:String)-instance-method","name":"find_variable","doc":"Returns variable by its name or `nil` if it does not exist.\n\n```\nscope = Scope.new(class_node, nil)\nscope.find_variable(\"foo\")\n```","summary":"

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

","abstract":false,"args":[{"name":"name","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/ast/scope.cr","line_number":98,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L98"},"def":{"name":"find_variable","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"variables.find() do |__arg1|\n __arg1.name == name\nend || outer_scope.try(&.find_variable(name))"}},{"html_id":"fun_def?(*,check_outer_scopes=false)-instance-method","name":"fun_def?","doc":"Returns `true` if current scope is a fun def, `false` otherwise.","summary":"

Returns true if current scope is a fun def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"fun_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::FunDef) || (!(!(check_outer_scopes && outer_scope.try(&.fun_def?(check_outer_scopes: true)))))"}},{"html_id":"hash(hasher)-instance-method","name":"hash","doc":"See `Object#hash(hasher)`","summary":"

See Object#hash(hasher)

","abstract":false,"args":[{"name":"hasher","external_name":"hasher","restriction":""}],"args_string":"(hasher)","args_html":"(hasher)","def":{"name":"hash","args":[{"name":"hasher","external_name":"hasher","restriction":""}],"visibility":"Public","body":"hasher = node.hash(hasher)\nhasher = location.hash(hasher)\nhasher\n"}},{"html_id":"in_macro?-instance-method","name":"in_macro?","doc":"Returns `true` if current scope sits inside a macro.","summary":"

Returns true if current scope sits inside a macro.

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":132,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L132"},"def":{"name":"in_macro?","visibility":"Public","body":"((node.is_a?(Crystal::Macro) || node.is_a?(Crystal::MacroIf)) || node.is_a?(Crystal::MacroFor)) || (!(!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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L32"},"def":{"name":"inner_scopes","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L23"},"def":{"name":"ivariables","visibility":"Public","body":"@ivariables"}},{"html_id":"lib_def?(*,check_outer_scopes=false)-instance-method","name":"lib_def?","doc":"Returns `true` if current scope is a lib def, `false` otherwise.","summary":"

Returns true if current scope is a lib def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"lib_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::LibDef) || (!(!(check_outer_scopes && outer_scope.try(&.lib_def?(check_outer_scopes: true)))))"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"module_def?(*,check_outer_scopes=false)-instance-method","name":"module_def?","doc":"Returns `true` if current scope is a module def, `false` otherwise.","summary":"

Returns true if current scope is a module def, false otherwise.

","abstract":false,"args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"args_string":"(*, check_outer_scopes = false)","args_html":"(*, check_outer_scopes = false)","location":{"filename":"src/ameba/ast/scope.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L183"},"def":{"name":"module_def?","args":[{"name":"","external_name":"","restriction":""},{"name":"check_outer_scopes","default_value":"false","external_name":"check_outer_scopes","restriction":""}],"splat_index":0,"visibility":"Public","body":"node.is_a?(Crystal::ModuleDef) || (!(!(check_outer_scopes && outer_scope.try(&.module_def?(check_outer_scopes: true)))))"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L35"},"def":{"name":"node","return_type":"Crystal::ASTNode","visibility":"Public","body":"@node"}},{"html_id":"outer_scope:Scope|Nil-instance-method","name":"outer_scope","doc":"Link to the outer scope","summary":"

Link to the outer scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L29"},"def":{"name":"outer_scope","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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L17"},"def":{"name":"references","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,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","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":165,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L165"},"def":{"name":"references?","args":[{"name":"variable","external_name":"variable","restriction":"Variable"},{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"variable.references.any? do |reference|\n (reference.scope == self) || (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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":127,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L127"},"def":{"name":"spawn_block?","visibility":"Public","body":"(node.as?(Crystal::Block)).try(&.call).try(&.name) == \"spawn\""}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/scope.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L37"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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` otherwise.","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":194,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L194"},"def":{"name":"top_level?","visibility":"Public","body":"outer_scope.nil?"}},{"html_id":"type_dec_variables:Array(Ameba::AST::TypeDecVariable)-instance-method","name":"type_dec_variables","doc":"Link to the type declaration variables used in current scope","summary":"

Link to the type declaration variables used in current scope

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L26"},"def":{"name":"type_dec_variables","visibility":"Public","body":"@type_dec_variables"}},{"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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":153,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L153"},"def":{"name":"type_definition?","visibility":"Public","body":"(((((node.is_a?(Crystal::ClassDef) || node.is_a?(Crystal::ModuleDef)) || node.is_a?(Crystal::EnumDef)) || 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,"location":{"filename":"src/ameba/ast/scope.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L14"},"def":{"name":"variables","visibility":"Public","body":"@variables"}},{"html_id":"visibility-instance-method","name":"visibility","doc":"Returns visibility of the current scope (could be inherited from the outer scope).","summary":"

Returns visibility of the current scope (could be inherited from the outer scope).

","abstract":false,"location":{"filename":"src/ameba/ast/scope.cr","line_number":179,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L179"},"def":{"name":"visibility","visibility":"Public","body":"@visibility || outer_scope.try(&.visibility)"}},{"html_id":"visibility=(visibility:Crystal::Visibility|Nil)-instance-method","name":"visibility=","doc":"Scope visibility level","summary":"

Scope visibility level

","abstract":false,"args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"args_string":"(visibility : Crystal::Visibility | Nil)","args_html":"(visibility : Crystal::Visibility | Nil)","location":{"filename":"src/ameba/ast/scope.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L11"},"def":{"name":"visibility=","args":[{"name":"visibility","external_name":"visibility","restriction":"Crystal::Visibility | ::Nil"}],"visibility":"Public","body":"@visibility = visibility"}},{"html_id":"yields=(yields:Bool)-instance-method","name":"yields=","doc":"Whether the scope yields.","summary":"

Whether the scope yields.

","abstract":false,"args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"args_string":"(yields : Bool)","args_html":"(yields : Bool)","location":{"filename":"src/ameba/ast/scope.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L8"},"def":{"name":"yields=","args":[{"name":"yields","external_name":"yields","restriction":"::Bool"}],"visibility":"Public","body":"@yields = yields"}},{"html_id":"yields?(check_inner_scopes=true)-instance-method","name":"yields?","doc":"Returns `true` if current scope (or any of inner scopes) yields,\n`false` otherwise.","summary":"

Returns true if current scope (or any of inner scopes) yields, false otherwise.

","abstract":false,"args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"args_string":"(check_inner_scopes = true)","args_html":"(check_inner_scopes = true)","location":{"filename":"src/ameba/ast/scope.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/scope.cr#L174"},"def":{"name":"yields?","args":[{"name":"check_inner_scopes","default_value":"true","external_name":"check_inner_scopes","restriction":""}],"visibility":"Public","body":"@yields || (check_inner_scopes && inner_scopes.any?(&.yields?))"}}]},{"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/6d03cef/src/ameba/ast/visitors/scope_visitor.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"NODES","name":"NODES","value":"{ClassDef, ModuleDef, EnumDef, LibDef, FunDef, TypeDef, TypeOf, CStructOrUnionDef, ProcLiteral, Block, Macro, MacroIf, MacroFor}","doc":"Non-exhaustive list of nodes to be visited by Ameba's rules.","summary":"

Non-exhaustive list of nodes to be visited by Ameba's rules.

"},{"id":"SPECIAL_NODE_NAMES","name":"SPECIAL_NODE_NAMES","value":"[\"super\", \"previous_def\"] of ::String"}],"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.

","constructors":[{"html_id":"new(rule,source,skip=nil)-class-method","name":"new","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","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/scope_visitor.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/scope_visitor.cr#L31"},"def":{"name":"new","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"source","external_name":"source","restriction":""},{"name":"skip","default_value":"nil","external_name":"skip","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(rule, source, skip)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]},{"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/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L8"},"def":{"name":"new","args":[{"name":"scope","external_name":"scope","restriction":"Crystal::ASTNode"}],"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","abstract":false,"location":{"filename":"src/ameba/ast/visitors/top_level_nodes_visitor.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L5"},"def":{"name":"require_nodes","visibility":"Public","body":"@require_nodes"}},{"html_id":"visit(node:Crystal::Expressions)-instance-method","name":"visit","doc":"If a top level node is `Crystal::Expressions`,\nthen always traverse the children.","summary":"

If a top level node is Crystal::Expressions, then always traverse the children.

","abstract":false,"args":[{"name":"node","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":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L20"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/visitors/top_level_nodes_visitor.cr#L26"},"def":{"name":"visit","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"false"}}]},{"html_id":"ameba/Ameba/AST/TypeDecVariable","path":"Ameba/AST/TypeDecVariable.html","kind":"class","full_name":"Ameba::AST::TypeDecVariable","name":"TypeDecVariable","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/type_dec_variable.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/AST","kind":"module","full_name":"Ameba::AST","name":"AST"},"constructors":[{"html_id":"new(node:Crystal::TypeDeclaration)-class-method","name":"new","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"args_string":"(node : Crystal::TypeDeclaration)","args_html":"(node : Crystal::TypeDeclaration)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L8"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::TypeDeclaration"}],"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name-instance-method","name":"name","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L11"},"def":{"name":"name","visibility":"Public","body":"case var = @node.var\nwhen Crystal::Var, Crystal::InstanceVar, Crystal::ClassVar, Crystal::Global\n var.name\nelse\n raise(\"Unsupported var node type: #{var.class}\")\nend"}},{"html_id":"node:Crystal::TypeDeclaration-instance-method","name":"node","abstract":false,"location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L3"},"def":{"name":"node","return_type":"Crystal::TypeDeclaration","visibility":"Public","body":"@node"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/ast/variabling/type_dec_variable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/type_dec_variable.cr#L5"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.to_s(*args, **options) do |*yield_args|\n yield *yield_args\nend"}}]},{"html_id":"ameba/Ameba/AST/Util","path":"Ameba/AST/Util.html","kind":"module","full_name":"Ameba::AST::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/ast/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Rule/Lint/AmbiguousAssignment","kind":"class","full_name":"Ameba::Rule::Lint::AmbiguousAssignment","name":"AmbiguousAssignment"},{"html_id":"ameba/Ameba/Rule/Lint/ComparisonToBoolean","kind":"class","full_name":"Ameba::Rule::Lint::ComparisonToBoolean","name":"ComparisonToBoolean"},{"html_id":"ameba/Ameba/Rule/Lint/EmptyLoop","kind":"class","full_name":"Ameba::Rule::Lint::EmptyLoop","name":"EmptyLoop"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/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/VerboseBlock","kind":"class","full_name":"Ameba::Rule::Style::VerboseBlock","name":"VerboseBlock"}],"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.

","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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L180"},"def":{"name":"abort?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"abort\")) && node.args.size <= 2) && node.obj.nil?"}},{"html_id":"control_exp_code(node:Crystal::ControlExpression,code_lines)-instance-method","name":"control_exp_code","doc":"Returns the exp code of a control expression.\nWraps implicit tuple literal with curly brackets (e.g. multi-return).","summary":"

Returns the exp code of a control expression.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node : Crystal::ControlExpression, code_lines)","args_html":"(node : Crystal::ControlExpression, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":199,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L199"},"def":{"name":"control_exp_code","args":[{"name":"node","external_name":"node","restriction":"Crystal::ControlExpression"},{"name":"code_lines","external_name":"code_lines","restriction":""}],"visibility":"Public","body":"if exp = node.exp\nelse\n return\nend\nif exp_code = node_source(exp, code_lines)\nelse\n return\nend\nif exp.is_a?(Crystal::TupleLiteral) && (exp_code[0] != '{')\nelse\n return exp_code\nend\nif exp_start = exp.elements.first.location\nelse\n return\nend\nif exp_end = exp.end_location\nelse\n return\nend\n\"{#{source_between(exp_start, exp_end, code_lines)}}\"\n"}},{"html_id":"dynamic_literal?(node):Bool-instance-method","name":"dynamic_literal?","doc":"Returns `true` if current `node` is a dynamic literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L48"},"def":{"name":"dynamic_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && (!is_static)\n"}},{"html_id":"exit?(node)-instance-method","name":"exit?","doc":"Returns `true` if node represents `exit` method call.","summary":"

Returns true if node represents exit method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L174"},"def":{"name":"exit?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"exit\")) && node.args.size <= 1) && node.obj.nil?"}},{"html_id":"flow_command?(node,in_loop)-instance-method","name":"flow_command?","doc":"Returns `true` if node is a flow command, `false` otherwise.\nNode represents a flow command if it is a control expression,\nor special call node that interrupts execution (i.e. raise, exit, abort).","summary":"

Returns true if node is a flow command, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"args_string":"(node, in_loop)","args_html":"(node, in_loop)","location":{"filename":"src/ameba/ast/util.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L102"},"def":{"name":"flow_command?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","external_name":"in_loop","restriction":""}],"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","external_name":"node","restriction":""},{"name":"in_loop","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":140,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L140"},"def":{"name":"flow_expression?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"in_loop","default_value":"false","external_name":"in_loop","restriction":""}],"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):Bool-instance-method","name":"literal?","doc":"Returns `true` if current `node` is a literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L54"},"def":{"name":"literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, _ = literal_kind?(node)\nis_literal\n"}},{"html_id":"loop?(node)-instance-method","name":"loop?","doc":"Returns `true` if node represents a loop.","summary":"

Returns true if node represents a loop.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":186,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L186"},"def":{"name":"loop?","args":[{"name":"node","external_name":"node","restriction":""}],"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":"name_end_location(node)-instance-method","name":"name_end_location","doc":"Returns `nil` if *node* does not contain a name.\n\nNOTE: Use this instead of `Crystal::Call#name_end_location` to avoid an\n off-by-one error.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":242,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L242"},"def":{"name":"name_end_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = name_location(node)\nelse\n return\nend\nif (size = name_size(node)).zero?\n return\nend\nloc.adjust(column_number: size - 1)\n"}},{"html_id":"name_location(node)-instance-method","name":"name_location","doc":"Returns `nil` if *node* does not contain a name.","summary":"

Returns nil if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":210,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L210"},"def":{"name":"name_location","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if loc = node.name_location\n return loc\nend\nif node.is_a?(Crystal::TypeDeclaration) || node.is_a?(Crystal::UninitializedVar)\n return node.var.location\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return\nend\nif name.is_a?(Crystal::ASTNode)\nelse\n return\nend\nname.location\n"}},{"html_id":"name_size(node)-instance-method","name":"name_size","doc":"Returns zero if *node* does not contain a name.","summary":"

Returns zero if node does not contain a name.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":224,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L224"},"def":{"name":"name_size","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"if (size = node.name_size).zero?\nelse\n return size\nend\nif (node.responds_to?(:name)) && (name = node.name)\nelse\n return 0\nend\ncase name\nwhen Crystal::ASTNode\n name.name_size\nwhen Crystal::Token::Kind\n name.to_s.size\nelse\n name.size\nend\n"}},{"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","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(node, code_lines)","args_html":"(node, code_lines)","location":{"filename":"src/ameba/ast/util.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L69"},"def":{"name":"node_source","args":[{"name":"node","external_name":"node","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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":"path_named?(node,name):Bool-instance-method","name":"path_named?","doc":"Returns `true` if current `node` is a `Crystal::Path`\nmatching given *name*, `false` otherwise.","summary":"

Returns true if current node is a Crystal::Path matching given name, false otherwise.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"args_string":"(node, name) : Bool","args_html":"(node, name) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L61"},"def":{"name":"path_named?","args":[{"name":"node","external_name":"node","restriction":""},{"name":"name","external_name":"name","restriction":""}],"return_type":"Bool","visibility":"Public","body":"node.is_a?(Crystal::Path) && (name == (node.names.join(\"::\")))"}},{"html_id":"raise?(node)-instance-method","name":"raise?","doc":"Returns `true` if node represents `raise` method call.","summary":"

Returns true if node represents raise method call.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/util.cr","line_number":168,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L168"},"def":{"name":"raise?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"((node.is_a?(Crystal::Call) && (node.name == \"raise\")) && (node.args.size == 1)) && node.obj.nil?"}},{"html_id":"source_between(loc,end_loc,code_lines):String|Nil-instance-method","name":"source_between","doc":"Returns the source code from *loc* to *end_loc* (inclusive).","summary":"

Returns the source code from loc to end_loc (inclusive).

","abstract":false,"args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"args_string":"(loc, end_loc, code_lines) : String | Nil","args_html":"(loc, end_loc, code_lines) : String | Nil","location":{"filename":"src/ameba/ast/util.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L77"},"def":{"name":"source_between","args":[{"name":"loc","external_name":"loc","restriction":""},{"name":"end_loc","external_name":"end_loc","restriction":""},{"name":"code_lines","external_name":"code_lines","restriction":""}],"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"}},{"html_id":"static_literal?(node):Bool-instance-method","name":"static_literal?","doc":"Returns `true` if current `node` is a static literal, `false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node) : Bool","args_html":"(node) : Bool","location":{"filename":"src/ameba/ast/util.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/util.cr#L42"},"def":{"name":"static_literal?","args":[{"name":"node","external_name":"node","restriction":""}],"return_type":"Bool","visibility":"Public","body":"is_literal, is_static = literal_kind?(node)\nis_literal && is_static\n"}}]},{"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/6d03cef/src/ameba/ast/variabling/variable.cr#L4"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/AST/Reference","kind":"class","full_name":"Ameba::AST::Reference","name":"Reference"}],"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 assignments.","summary":"

Represents the existence of the local variable.

","constructors":[{"html_id":"new(node:Crystal::Var,scope:Ameba::AST::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","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"args_string":"(node : Crystal::Var, scope : Ameba::AST::Scope)","args_html":"(node : Crystal::Var, scope : Ameba::AST::Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L28"},"def":{"name":"new","args":[{"name":"node","external_name":"node","restriction":"::Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"::Ameba::AST::Scope"}],"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","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"args_string":"(node, scope)","args_html":"(node, scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L45"},"def":{"name":"assign","args":[{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":""}],"visibility":"Public","body":"assignments << (Assignment.new(node, self, scope))\nupdate_assign_reference!\n"}},{"html_id":"assign_before_reference:Crystal::ASTNode|Nil-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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L18"},"def":{"name":"assign_before_reference","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 assignments of this variable.","summary":"

List of the assignments of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L6"},"def":{"name":"assignments","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","default_value":"@scope","external_name":"scope","restriction":""}],"args_string":"(scope = @scope)","args_html":"(scope = @scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":114,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L114"},"def":{"name":"captured_by_block?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":163,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L163"},"def":{"name":"declared_before?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"var_location, node_location = location, node.location\nif var_location && node_location\nelse\n return\nend\n(var_location.line_number < node_location.line_number) || ((var_location.line_number == node_location.line_number) && var_location.column_number < node_location.column_number)\n"}},{"html_id":"end_location(*args,**options)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.end_location(*args, **options)"}},{"html_id":"end_location(*args,**options,&)-instance-method","name":"end_location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"end_location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":""}],"args_string":"(node)","args_html":"(node)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L156"},"def":{"name":"eql?","args":[{"name":"node","external_name":"node","restriction":""}],"visibility":"Public","body":"(node.is_a?(Crystal::Var) && (node.name == @node.name)) && (node.location == @node.location)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":150,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L150"},"def":{"name":"ignored?","visibility":"Public","body":"name.starts_with?('_')"}},{"html_id":"location(*args,**options)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.location(*args, **options)"}},{"html_id":"location(*args,**options,&)-instance-method","name":"location","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"location","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"@node.location(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"name(*args,**options)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.name(*args, **options)"}},{"html_id":"name(*args,**options,&)-instance-method","name":"name","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"name","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L12"},"def":{"name":"node","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","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","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":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L68"},"def":{"name":"reference","args":[{"name":"node","external_name":"node","restriction":"Crystal::Var"},{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"(Reference.new(node, scope)).tap do |reference|\n references << reference\n scope.references << reference\nend"}},{"html_id":"reference(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":"scope","external_name":"scope","restriction":"Scope"}],"args_string":"(scope : Scope)","args_html":"(scope : Scope)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L76"},"def":{"name":"reference","args":[{"name":"scope","external_name":"scope","restriction":"Scope"}],"visibility":"Public","body":"reference(node, scope)"}},{"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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L87"},"def":{"name":"reference_assignments!","visibility":"Public","body":"consumed_branches = Set(Branch).new\nassignments.reverse_each do |assignment|\n if assignment.branch.in?(consumed_branches)\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, some_scope)\nvariable.referenced? # => true\n```","summary":"

Returns true if variable has any reference.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L58"},"def":{"name":"referenced?","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,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L9"},"def":{"name":"references","visibility":"Public","body":"@references"}},{"html_id":"scope:Scope-instance-method","name":"scope","doc":"Scope of this variable.","summary":"

Scope of this variable.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L15"},"def":{"name":"scope","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 $?.

","abstract":false,"location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L32"},"def":{"name":"special?","visibility":"Public","body":"@node.special_var?"}},{"html_id":"target_of?(assign)-instance-method","name":"target_of?","doc":"Returns `true` if the variable is a target (on the left) of the assignment,\n`false` otherwise.","summary":"

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

","abstract":false,"args":[{"name":"assign","external_name":"assign","restriction":""}],"args_string":"(assign)","args_html":"(assign)","location":{"filename":"src/ameba/ast/variabling/variable.cr","line_number":138,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L138"},"def":{"name":"target_of?","args":[{"name":"assign","external_name":"assign","restriction":""}],"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 |target|\n eql?(target)\n end\nwhen Crystal::UninitializedVar\n eql?(assign.var)\nelse\n false\nend"}},{"html_id":"to_s(*args,**options)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"@node.to_s(*args, **options)"}},{"html_id":"to_s(*args,**options,&)-instance-method","name":"to_s","abstract":false,"args":[{"name":"args","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/6d03cef/src/ameba/ast/variabling/variable.cr#L20"},"def":{"name":"to_s","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"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,\n`false` if not.","summary":"

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

","abstract":false,"args":[{"name":"scope","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":126,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ast/variabling/variable.cr#L126"},"def":{"name":"used_in_macro?","args":[{"name":"scope","default_value":"@scope","external_name":"scope","restriction":""}],"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"}}]}]},{"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":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L37"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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}"},{"id":"DEFAULT_GLOBS","name":"DEFAULT_GLOBS","value":"[\"**/*.cr\", \"!lib\"] of ::String"},{"id":"DEFAULT_PATH","name":"DEFAULT_PATH","value":"Path[Dir.current] / FILENAME"},{"id":"DEFAULT_PATHS","name":"DEFAULT_PATHS","value":"{Path[\"~\"] / FILENAME, Path[XDG_CONFIG_HOME] / \"ameba/config.yml\"}"},{"id":"FILENAME","name":"FILENAME","value":"\".ameba.yml\""},{"id":"XDG_CONFIG_HOME","name":"XDG_CONFIG_HOME","value":"ENV.fetch(\"XDG_CONFIG_HOME\", \"~/.config\")"}],"included_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"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 located in a current\nworking directory.\n\nIf it cannot be found until reaching the root directory, then it will be\nsearched for in the user’s global config locations, which consists of a\ndotfile or a config file inside the XDG Base Directory specification.\n\n- `~/.ameba.yml`\n- `$XDG_CONFIG_HOME/ameba/config.yml` (expands to `~/.config/ameba/config.yml`\n if `$XDG_CONFIG_HOME` is not set)\n\nIf both files exist, the dotfile will be selected.\n\nAs an example, if Ameba is invoked from inside `/path/to/project/lib/utils`,\nthen it will use the config as specified inside the first of the following files:\n\n- `/path/to/project/lib/utils/.ameba.yml`\n- `/path/to/project/lib/.ameba.yml`\n- `/path/to/project/.ameba.yml`\n- `/path/to/.ameba.yml`\n- `/path/.ameba.yml`\n- `/.ameba.yml`\n- `~/.ameba.yml`\n- `~/.config/ameba/config.yml`","summary":"

A configuration entry for Ameba::Runner.

","class_methods":[{"html_id":"formatter_names-class-method","name":"formatter_names","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":145,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L145"},"def":{"name":"formatter_names","visibility":"Public","body":"AVAILABLE_FORMATTERS.keys.join('|')"}},{"html_id":"load(path=nil,colors=true,skip_reading_config=false)-class-method","name":"load","doc":"Loads YAML configuration file by `path`.\n\n```\nconfig = Ameba::Config.load\n```","summary":"

Loads YAML configuration file by path.

","abstract":false,"args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"args_string":"(path = nil, colors = true, skip_reading_config = false)","args_html":"(path = nil, colors = true, skip_reading_config = false)","location":{"filename":"src/ameba/config.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L110"},"def":{"name":"load","args":[{"name":"path","default_value":"nil","external_name":"path","restriction":""},{"name":"colors","default_value":"true","external_name":"colors","restriction":""},{"name":"skip_reading_config","default_value":"false","external_name":"skip_reading_config","restriction":""}],"visibility":"Public","body":"begin\n Colorize.enabled = colors\n content = if skip_reading_config\n \"{}\"\n else\n (read_config(path)) || \"{}\"\n end\n Config.new(YAML.parse(content))\nrescue e\n raise(\"Unable to load config file: #{e.message}\")\nend"}}],"instance_methods":[{"html_id":"autocorrect=(autocorrect:Bool)-instance-method","name":"autocorrect=","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"args_string":"(autocorrect : Bool)","args_html":"(autocorrect : Bool)","location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L87"},"def":{"name":"autocorrect=","args":[{"name":"autocorrect","external_name":"autocorrect","restriction":"::Bool"}],"visibility":"Public","body":"@autocorrect = autocorrect"}},{"html_id":"autocorrect?:Bool-instance-method","name":"autocorrect?","doc":"Returns `true` if correctable issues should be autocorrected.","summary":"

Returns true if correctable issues should be autocorrected.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L87"},"def":{"name":"autocorrect?","visibility":"Public","body":"@autocorrect"}},{"html_id":"excluded:Array(String)-instance-method","name":"excluded","doc":"Represents a list of paths to exclude from globs.\nCan have wildcards.\n\n```\nconfig = Ameba::Config.load\nconfig.excluded = [\"spec\", \"src/server/*.cr\"]\n```","summary":"

Represents a list of paths to exclude from globs.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L84"},"def":{"name":"excluded","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","external_name":"excluded","restriction":"Array(String)"}],"args_string":"(excluded : Array(String))","args_html":"(excluded : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":84,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L84"},"def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String)"}],"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L171"},"def":{"name":"formatter","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","external_name":"name","restriction":"String | Symbol"}],"args_string":"(name : String | Symbol)","args_html":"(name : String | Symbol)","location":{"filename":"src/ameba/config.cr","line_number":181,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L181"},"def":{"name":"formatter=","args":[{"name":"name","external_name":"name","restriction":"String | Symbol"}],"visibility":"Public","body":"if formatter = AVAILABLE_FORMATTERS[name]?\nelse\n raise(\"Unknown formatter `#{name}`. Use one of #{Config.formatter_names}.\")\nend\n@formatter = formatter.new\n"}},{"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```","summary":"

Returns a formatter to be used while inspecting files.

","abstract":false,"args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"args_string":"(formatter : Formatter::BaseFormatter)","args_html":"(formatter : Formatter::BaseFormatter)","location":{"filename":"src/ameba/config.cr","line_number":171,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L171"},"def":{"name":"formatter=","args":[{"name":"formatter","external_name":"formatter","restriction":"Formatter::BaseFormatter"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L75"},"def":{"name":"globs","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","external_name":"globs","restriction":"Array(String)"}],"args_string":"(globs : Array(String))","args_html":"(globs : Array(String))","location":{"filename":"src/ameba/config.cr","line_number":75,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L75"},"def":{"name":"globs=","args":[{"name":"globs","external_name":"globs","restriction":"Array(String)"}],"visibility":"Public","body":"@globs = globs"}},{"html_id":"rules:Array(Rule::Base)-instance-method","name":"rules","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L63"},"def":{"name":"rules","return_type":"Array(Rule::Base)","visibility":"Public","body":"@rules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L64"},"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","location":{"filename":"src/ameba/config.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L64"},"def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"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,"location":{"filename":"src/ameba/config.cr","line_number":158,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L158"},"def":{"name":"sources","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","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":194,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L194"},"def":{"name":"update_rule","args":[{"name":"name","external_name":"name","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/config.cr#L215"},"def":{"name":"update_rules","args":[{"name":"names","external_name":"names","restriction":""},{"name":"enabled","default_value":"true","external_name":"enabled","restriction":""},{"name":"excluded","default_value":"nil","external_name":"excluded","restriction":""}],"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)"}}]},{"html_id":"ameba/Ameba/Ext","path":"Ameba/Ext.html","kind":"module","full_name":"Ameba::Ext","name":"Ext","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Ext/Location","path":"Ameba/Ext/Location.html","kind":"module","full_name":"Ameba::Ext::Location","name":"Location","abstract":false,"locations":[{"filename":"src/ameba/ext/location.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"including_types":[{"html_id":"ameba/Crystal/Location","kind":"class","full_name":"Crystal::Location","name":"Location"}],"namespace":{"html_id":"ameba/Ameba/Ext","kind":"module","full_name":"Ameba::Ext","name":"Ext"},"doc":"Extensions to Crystal::Location","summary":"

Extensions to Crystal::Location

","instance_methods":[{"html_id":"adjust(line_number=0,column_number=0):self-instance-method","name":"adjust","doc":"Returns the same location as this location but with the line and/or column number(s) adjusted\nby the given amount(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) adjusted by the given amount(s).

","abstract":false,"args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"args_string":"(line_number = 0, column_number = 0) : self","args_html":"(line_number = 0, column_number = 0) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L11"},"def":{"name":"adjust","args":[{"name":"line_number","default_value":"0","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"0","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, @line_number + line_number, @column_number + column_number)"}},{"html_id":"seek(offset:self):self-instance-method","name":"seek","doc":"Seeks to a given *offset* relative to `self`.","summary":"

Seeks to a given offset relative to self.

","abstract":false,"args":[{"name":"offset","external_name":"offset","restriction":"self"}],"args_string":"(offset : self) : self","args_html":"(offset : self) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L16"},"def":{"name":"seek","args":[{"name":"offset","external_name":"offset","restriction":"self"}],"return_type":"self","visibility":"Public","body":"if (offset.filename.as?(String)).presence && (@filename != offset.filename)\n raise(ArgumentError.new(\"Mismatching filenames:\\n #{@filename}\\n #{offset.filename}\"))\nend\nif offset.line_number == 1\n self.class.new(@filename, @line_number, (@column_number + offset.column_number) - 1)\nelse\n self.class.new(@filename, (@line_number + offset.line_number) - 1, offset.column_number)\nend\n"}},{"html_id":"with(line_number=@line_number,column_number=@column_number):self-instance-method","name":"with","doc":"Returns the same location as this location but with the line and/or column number(s) changed\nto the given value(s).","summary":"

Returns the same location as this location but with the line and/or column number(s) changed to the given value(s).

","abstract":false,"args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"args_string":"(line_number = @line_number, column_number = @column_number) : self","args_html":"(line_number = @line_number, column_number = @column_number) : self","location":{"filename":"src/ameba/ext/location.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/ext/location.cr#L5"},"def":{"name":"with","args":[{"name":"line_number","default_value":"@line_number","external_name":"line_number","restriction":""},{"name":"column_number","default_value":"@column_number","external_name":"column_number","restriction":""}],"return_type":"self","visibility":"Public","body":"self.class.new(@filename, line_number, column_number)"}}]}]},{"html_id":"ameba/Ameba/Formatter","path":"Ameba/Formatter.html","kind":"module","full_name":"Ameba::Formatter","name":"Formatter","abstract":false,"locations":[{"filename":"src/ameba/formatter/base_formatter.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/src/ameba/formatter/todo_formatter.cr#L1"},{"filename":"src/ameba/formatter/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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/6d03cef/src/ameba/formatter/base_formatter.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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.

","constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/base_formatter.cr#L13"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/base_formatter.cr#L11"},"def":{"name":"config","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","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/6d03cef/src/ameba/formatter/base_formatter.cr#L30"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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,"location":{"filename":"src/ameba/formatter/base_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/base_formatter.cr#L10"},"def":{"name":"output","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","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/6d03cef/src/ameba/formatter/base_formatter.cr#L26"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":""}},{"html_id":"source_started(source:Source)-instance-method","name":"source_started","doc":"Callback that indicates when source inspection is started.\nA corresponding source is passed as an argument.","summary":"

Callback that indicates when source inspection is started.

","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/formatter/base_formatter.cr#L22"},"def":{"name":"source_started","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/6d03cef/src/ameba/formatter/base_formatter.cr#L18"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":""}}]},{"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/6d03cef/src/ameba/formatter/disabled_formatter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","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","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/6d03cef/src/ameba/formatter/disabled_formatter.cr#L4"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"output << \"Disabled rules using inline directives:\\n\\n\"\nsources.each do |source|\n source.issues.select(&.disabled?).each do |issue|\n if loc = issue.location\n else\n next\n end\n output << (\"#{source.path}:#{loc.line_number}\".colorize(:cyan))\n output << \" #{issue.rule.name}\\n\"\n end\nend\n"}}]},{"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/6d03cef/src/ameba/formatter/dot_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"subclasses":[{"html_id":"ameba/Ameba/Formatter/TODOFormatter","kind":"class","full_name":"Ameba::Formatter::TODOFormatter","name":"TODOFormatter"}],"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.

","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","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/6d03cef/src/ameba/formatter/dot_formatter.cr#L27"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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.print(location.colorize(:cyan))\n if issue.correctable?\n if config[:autocorrect]?\n output.print(\" [Corrected]\".colorize(:green))\n else\n output.print(\" [Correctable]\".colorize(:yellow))\n end\n end\n output.puts\n output.puts((\"[%s] %s: %s\" % {issue.rule.severity.symbol, issue.rule.name, issue.message}).colorize(issue.rule.severity.color))\n if show_affected_code && (code = affected_code(issue))\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","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/6d03cef/src/ameba/formatter/dot_formatter.cr#L21"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"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","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/6d03cef/src/ameba/formatter/dot_formatter.cr#L13"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@started_at = Time.monotonic\noutput.puts(started_message(sources.size))\noutput.puts\n"}}]},{"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/6d03cef/src/ameba/formatter/explain_formatter.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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.

","constructors":[{"html_id":"new(output:IO,location)-class-method","name":"new","doc":"Creates a new instance of `ExplainFormatter`.\n\nAccepts *output* which indicates the io where the explanation will be written to.\nSecond argument is *location* which indicates the location to explain.\n\n```\nExplainFormatter.new output, {\n file: path,\n line: line_number,\n column: column_number,\n}\n```","summary":"

Creates a new instance of ExplainFormatter.

","abstract":false,"args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"args_string":"(output : IO, location)","args_html":"(output : IO, location)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L24"},"def":{"name":"new","args":[{"name":"output","external_name":"output","restriction":"::IO"},{"name":"location","external_name":"location","restriction":""}],"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 explanations at the *@location*.","summary":"

Reports the explanations at the @location.

","abstract":false,"args":[{"name":"sources","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L33"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L10"},"def":{"name":"location","return_type":"Crystal::Location","visibility":"Public","body":"@location"}},{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","abstract":false,"location":{"filename":"src/ameba/formatter/explain_formatter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/explain_formatter.cr#L9"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"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/6d03cef/src/ameba/formatter/flycheck_formatter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Formatter","kind":"module","full_name":"Ameba::Formatter","name":"Formatter"},"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","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/6d03cef/src/ameba/formatter/flycheck_formatter.cr#L5"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n if loc = issue.location\n else\n next\n end\n @mutex.synchronize do\n output.printf(\"%s:%d:%d: %s: [%s] %s\\n\", source.path, loc.line_number, loc.column_number, issue.rule.severity.symbol, issue.rule.name, issue.message.gsub('\\n', \" \"))\n end\nend"}}]},{"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":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L65"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

A formatter that produces the result in a json format.

","constructors":[{"html_id":"new(output=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","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":66,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L66"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":94,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L94"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L74"},"def":{"name":"source_finished","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"json_source = AsJSON::Source.new(source.path)\nsource.issues.each do |issue|\n if issue.disabled?\n next\n end\n if issue.correctable? && config[:autocorrect]?\n next\n end\n json_source.issues << (AsJSON::Issue.new(issue.rule.name, issue.rule.severity.to_s, issue.location, issue.end_location, issue.message))\n __temp_54 = @result.summary\n __temp_54.issues_count = __temp_54.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","external_name":"sources","restriction":""}],"args_string":"(sources)","args_html":"(sources)","location":{"filename":"src/ameba/formatter/json_formatter.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/json_formatter.cr#L70"},"def":{"name":"started","args":[{"name":"sources","external_name":"sources","restriction":""}],"visibility":"Public","body":"@result.summary.target_sources_count = sources.size"}}]},{"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/6d03cef/src/ameba/formatter/todo_formatter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(output=STDOUT,config_path:Path=Config::DEFAULT_PATH)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"args_string":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","args_html":"(output = STDOUT, config_path : Path = Config::DEFAULT_PATH)","location":{"filename":"src/ameba/formatter/todo_formatter.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/todo_formatter.cr#L6"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""},{"name":"config_path","default_value":"Config::DEFAULT_PATH","external_name":"config_path","restriction":"Path"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output, config_path)\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","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/6d03cef/src/ameba/formatter/todo_formatter.cr#L9"},"def":{"name":"finished","args":[{"name":"sources","external_name":"sources","restriction":""}],"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\n(generate_todo_config(issues)).tap do |file|\n @output.puts(\"Created #{file.path}\")\nend\n"}}]},{"html_id":"ameba/Ameba/Formatter/Util","path":"Ameba/Formatter/Util.html","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/formatter/util.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"ameba/Ameba/Formatter/Util","kind":"module","full_name":"Ameba::Formatter::Util","name":"Util"}],"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"},"instance_methods":[{"html_id":"affected_code(issue:Issue,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(issue : Issue, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L45"},"def":{"name":"affected_code","args":[{"name":"issue","external_name":"issue","restriction":"Issue"},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"if location = issue.location\nelse\n return\nend\naffected_code(issue.code, location, issue.end_location, context_lines, max_length, ellipsis, prompt)\n"}},{"html_id":"affected_code(code,location,end_location=nil,context_lines=0,max_length=120,ellipsis=\"...\",prompt=\">\")-instance-method","name":"affected_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"args_string":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = \" ...\", prompt = \"> \")","args_html":"(code, location, end_location = nil, context_lines = 0, max_length = 120, ellipsis = " ...", prompt = "> ")","location":{"filename":"src/ameba/formatter/util.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L51"},"def":{"name":"affected_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"location","external_name":"location","restriction":""},{"name":"end_location","default_value":"nil","external_name":"end_location","restriction":""},{"name":"context_lines","default_value":"0","external_name":"context_lines","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""},{"name":"prompt","default_value":"\"> \"","external_name":"prompt","restriction":""}],"visibility":"Public","body":"lines = code.split('\\n')\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","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","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":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L19"},"def":{"name":"context","args":[{"name":"lines","external_name":"lines","restriction":""},{"name":"lineno","external_name":"lineno","restriction":""},{"name":"context_lines","default_value":"3","external_name":"context_lines","restriction":""},{"name":"remove_empty","default_value":"true","external_name":"remove_empty","restriction":""}],"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|Nil):String|Nil-instance-method","name":"deansify","abstract":false,"args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"args_string":"(message : String | Nil) : String | Nil","args_html":"(message : String | Nil) : String | Nil","location":{"filename":"src/ameba/formatter/util.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L5"},"def":{"name":"deansify","args":[{"name":"message","external_name":"message","restriction":"String | ::Nil"}],"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","abstract":false,"args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","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":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/formatter/util.cr#L9"},"def":{"name":"trim","args":[{"name":"str","external_name":"str","restriction":""},{"name":"max_length","default_value":"120","external_name":"max_length","restriction":""},{"name":"ellipsis","default_value":"\" ...\"","external_name":"ellipsis","restriction":""}],"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"}}]}]},{"html_id":"ameba/Ameba/GlobUtils","path":"Ameba/GlobUtils.html","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils","abstract":false,"locations":[{"filename":"src/ameba/glob_utils.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"extended_modules":[{"html_id":"ameba/Ameba/GlobUtils","kind":"module","full_name":"Ameba::GlobUtils","name":"GlobUtils"}],"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.

","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","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L24"},"def":{"name":"expand","args":[{"name":"globs","external_name":"globs","restriction":""}],"visibility":"Public","body":"globs.flat_map do |glob|\n if File.directory?(glob)\n glob = glob + \"/**/*.cr\"\n end\n Dir[glob]\nend.uniq!.select! do |path|\n File.file?(path)\nend"}},{"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","external_name":"globs","restriction":""}],"args_string":"(globs)","args_html":"(globs)","location":{"filename":"src/ameba/glob_utils.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/glob_utils.cr#L12"},"def":{"name":"find_files_by_globs","args":[{"name":"globs","external_name":"globs","restriction":""}],"visibility":"Public","body":"rejected = rejected_globs(globs)\nselected = globs - rejected\n(expand(selected)) - (expand(rejected.map!(&.[](1..-1))))\n"}}]},{"html_id":"ameba/Ameba/InlineComments","path":"Ameba/InlineComments.html","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments","abstract":false,"locations":[{"filename":"src/ameba/inline_comments.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"COMMENT_DIRECTIVE_REGEX","name":"COMMENT_DIRECTIVE_REGEX","value":"/# ameba:(?\\w+) (?\\w+(?:\\/\\w+)?(?:,? \\w+(?:\\/\\w+)?)*)/"}],"including_types":[{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"A module that utilizes inline comments parsing and processing logic.","summary":"

A module that utilizes inline comments parsing and processing logic.

","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.

","abstract":false,"args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"args_string":"(line_number : Int32)","args_html":"(line_number : Int32)","location":{"filename":"src/ameba/inline_comments.cr","line_number":78,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L78"},"def":{"name":"comment?","args":[{"name":"line_number","external_name":"line_number","restriction":"Int32"}],"visibility":"Public","body":"if line = lines[line_number]?\nelse\n return\nend\ncomment?(line)\n"}},{"html_id":"location_disabled?(location:Crystal::Location|Nil,rule)-instance-method","name":"location_disabled?","doc":"Returns `true` if current location is disabled for a particular rule,\n`false` otherwise.\n\nLocation is disabled in two cases:\n 1. The line of the location ends with a comment directive.\n 2. The line above the location is a comment directive.\n\nFor example, here are two examples of disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\nTime.epoch(1483859302)\n\nTime.epoch(1483859302) # ameba:disable Style/LargeNumbers\n```\n\nBut here are examples which are not considered as disabled location:\n\n```\n# ameba:disable Style/LargeNumbers\n#\nTime.epoch(1483859302)\n\nif use_epoch? # ameba:disable Style/LargeNumbers\n Time.epoch(1483859302)\nend\n```","summary":"

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

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(location : Crystal::Location | Nil, rule)","args_html":"(location : Crystal::Location | Nil, rule)","location":{"filename":"src/ameba/inline_comments.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L40"},"def":{"name":"location_disabled?","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"rule","external_name":"rule","restriction":""}],"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","external_name":"line","restriction":""}],"args_string":"(line)","args_html":"(line)","location":{"filename":"src/ameba/inline_comments.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L68"},"def":{"name":"parse_inline_directive","args":[{"name":"line","external_name":"line","restriction":""}],"visibility":"Public","body":"if directive = COMMENT_DIRECTIVE_REGEX.match(line)\nelse\n return\nend\nif commented_out?(line.gsub(directive[0], \"\"))\n return\nend\n{action: directive[\"action\"], rules: directive[\"rules\"].split(/[\\s,]/, remove_empty: true)}\n"}}],"types":[{"html_id":"ameba/Ameba/InlineComments/Action","path":"Ameba/InlineComments/Action.html","kind":"enum","full_name":"Ameba::InlineComments::Action","name":"Action","abstract":false,"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":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L8"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Disable","name":"Disable","value":"0"},{"id":"Enable","name":"Enable","value":"1"}],"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

","instance_methods":[{"html_id":"disable?-instance-method","name":"disable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L9"},"def":{"name":"disable?","visibility":"Public","body":"self == Disable"}},{"html_id":"enable?-instance-method","name":"enable?","abstract":false,"location":{"filename":"src/ameba/inline_comments.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/inline_comments.cr#L10"},"def":{"name":"enable?","visibility":"Public","body":"self == Enable"}}]}]},{"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/6d03cef/src/ameba/issue.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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.

","constructors":[{"html_id":"new(code:String,rule:Ameba::Rule::Base,location:Nil|Crystal::Location,end_location:Nil|Crystal::Location,message:String,status:Status|Nil=nil,block:Source::Corrector->|Nil=nil)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","args_html":"(code : String, rule : Ameba::Rule::Base, location : Nil | Crystal::Location, end_location : Nil | Crystal::Location, message : String, status : Status | Nil = nil, block : Source::Corrector -> | Nil = nil)","location":{"filename":"src/ameba/issue.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L30"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"rule","external_name":"rule","restriction":"::Ameba::Rule::Base"},{"name":"location","external_name":"location","restriction":"::Nil | ::Crystal::Location"},{"name":"end_location","external_name":"end_location","restriction":"::Nil | ::Crystal::Location"},{"name":"message","external_name":"message","restriction":"::String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, rule, location, end_location, message, status, block)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","doc":"The source code that triggered this issue.","summary":"

The source code that triggered this issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L10"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct(corrector)-instance-method","name":"correct","abstract":false,"args":[{"name":"corrector","external_name":"corrector","restriction":""}],"args_string":"(corrector)","args_html":"(corrector)","location":{"filename":"src/ameba/issue.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L42"},"def":{"name":"correct","args":[{"name":"corrector","external_name":"corrector","restriction":""}],"visibility":"Public","body":"@block.try(&.call(corrector))"}},{"html_id":"correctable?-instance-method","name":"correctable?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L38"},"def":{"name":"correctable?","visibility":"Public","body":"!@block.nil?"}},{"html_id":"disabled?(*args,**options)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.disabled?(*args, **options)"}},{"html_id":"disabled?(*args,**options,&)-instance-method","name":"disabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"disabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.disabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"enabled?(*args,**options)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options)","args_html":"(*args, **options)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"visibility":"Public","body":"status.enabled?(*args, **options)"}},{"html_id":"enabled?(*args,**options,&)-instance-method","name":"enabled?","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **options, &)","args_html":"(*args, **options, &)","location":{"filename":"src/ameba/issue.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L27"},"def":{"name":"enabled?","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"options","external_name":"options","restriction":""},"splat_index":0,"yields":1,"block_arity":1,"visibility":"Public","body":"status.enabled?(*args, **options) do |*yield_args|\n yield *yield_args\nend"}},{"html_id":"end_location:Crystal::Location|Nil-instance-method","name":"end_location","doc":"End location of the issue.","summary":"

End location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L19"},"def":{"name":"end_location","return_type":"Crystal::Location | ::Nil","visibility":"Public","body":"@end_location"}},{"html_id":"location:Crystal::Location|Nil-instance-method","name":"location","doc":"Location of the issue.","summary":"

Location of the issue.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L16"},"def":{"name":"location","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,"location":{"filename":"src/ameba/issue.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L22"},"def":{"name":"message","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,"location":{"filename":"src/ameba/issue.cr","line_number":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L13"},"def":{"name":"rule","return_type":"Rule::Base","visibility":"Public","body":"@rule"}},{"html_id":"status:Status-instance-method","name":"status","doc":"Issue status.","summary":"

Issue status.

","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L25"},"def":{"name":"status","return_type":"Status","visibility":"Public","body":"@status"}},{"html_id":"syntax?-instance-method","name":"syntax?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L34"},"def":{"name":"syntax?","visibility":"Public","body":"rule.is_a?(Rule::Lint::Syntax)"}}],"types":[{"html_id":"ameba/Ameba/Issue/Status","path":"Ameba/Issue/Status.html","kind":"enum","full_name":"Ameba::Issue::Status","name":"Status","abstract":false,"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/6d03cef/src/ameba/issue.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Enabled","name":"Enabled","value":"0"},{"id":"Disabled","name":"Disabled","value":"1"}],"namespace":{"html_id":"ameba/Ameba/Issue","kind":"struct","full_name":"Ameba::Issue","name":"Issue"},"instance_methods":[{"html_id":"disabled?-instance-method","name":"disabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L6"},"def":{"name":"disabled?","visibility":"Public","body":"self == Disabled"}},{"html_id":"enabled?-instance-method","name":"enabled?","abstract":false,"location":{"filename":"src/ameba/issue.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/issue.cr#L5"},"def":{"name":"enabled?","visibility":"Public","body":"self == Enabled"}}]}]},{"html_id":"ameba/Ameba/Presenter","path":"Ameba/Presenter.html","kind":"module","full_name":"Ameba::Presenter","name":"Presenter","abstract":false,"locations":[{"filename":"src/ameba/presenter/base_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_collection_presenter.cr#L1"},{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_presenter.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","path":"Ameba/Presenter/BasePresenter.html","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter","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/presenter/base_presenter.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"subclasses":[{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter"},{"html_id":"ameba/Ameba/Presenter/RulePresenter","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter"}],"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"constructors":[{"html_id":"new(output:IO=STDOUT)-class-method","name":"new","abstract":false,"args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"args_string":"(output : IO = STDOUT)","args_html":"(output : IO = STDOUT)","location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L9"},"def":{"name":"new","args":[{"name":"output","default_value":"STDOUT","external_name":"output","restriction":"::IO"}],"visibility":"Public","body":"_ = allocate\n_.initialize(output)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"output:IO::FileDescriptor|IO::Memory-instance-method","name":"output","doc":"TODO: allow other IOs","summary":"

TODO allow other IOs

","abstract":false,"location":{"filename":"src/ameba/presenter/base_presenter.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/base_presenter.cr#L7"},"def":{"name":"output","return_type":"IO::FileDescriptor | IO::Memory","visibility":"Public","body":"@output"}}]},{"html_id":"ameba/Ameba/Presenter/RuleCollectionPresenter","path":"Ameba/Presenter/RuleCollectionPresenter.html","kind":"class","full_name":"Ameba::Presenter::RuleCollectionPresenter","name":"RuleCollectionPresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_collection_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_collection_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rules)-instance-method","name":"run","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":""}],"args_string":"(rules)","args_html":"(rules)","location":{"filename":"src/ameba/presenter/rule_collection_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_collection_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rules","external_name":"rules","restriction":""}],"visibility":"Public","body":"rules = rules.to_h do |rule|\n name = rule.name.split('/')\n name = \"%s/%s\" % {(name[0...-1].join('/')).colorize(:light_gray), name.last.colorize(:white)}\n {name, rule}\nend\nlongest_name = rules.max_of() do |__arg0|\n __arg0.first.size\nend\nrules.group_by() do |__arg1|\n __arg1.last.group\nend.each do |group, group_rules|\n output.puts(\"— %s\" % (group.colorize(:light_blue)).underline)\n output.puts\n group_rules.each do |name, rule|\n output.puts(\" %s [%s] %s %s\" % {rule.enabled? ? ENABLED_MARK : DISABLED_MARK, rule.severity.symbol.to_s.colorize(:green), name.ljust(longest_name), rule.description.colorize(:dark_gray)})\n end\n output.puts\nend\noutput.puts(\"Total rules: %s / %s enabled\" % {rules.size.to_s.colorize(:light_blue), rules.count() do |__arg2|\n __arg2.last.enabled?\nend.to_s.colorize(:light_blue)})\n"}}]},{"html_id":"ameba/Ameba/Presenter/RulePresenter","path":"Ameba/Presenter/RulePresenter.html","kind":"class","full_name":"Ameba::Presenter::RulePresenter","name":"RulePresenter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},"ancestors":[{"html_id":"ameba/Ameba/Presenter/BasePresenter","kind":"class","full_name":"Ameba::Presenter::BasePresenter","name":"BasePresenter"},{"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/presenter/rule_presenter.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_presenter.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Presenter","kind":"module","full_name":"Ameba::Presenter","name":"Presenter"},"instance_methods":[{"html_id":"run(rule)-instance-method","name":"run","abstract":false,"args":[{"name":"rule","external_name":"rule","restriction":""}],"args_string":"(rule)","args_html":"(rule)","location":{"filename":"src/ameba/presenter/rule_presenter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/presenter/rule_presenter.cr#L3"},"def":{"name":"run","args":[{"name":"rule","external_name":"rule","restriction":""}],"visibility":"Public","body":"output.puts\noutput_title(\"Rule info\")\noutput_paragraph(\"%s of a %s severity [enabled: %s]\" % {rule.name.colorize(:magenta), rule.severity.to_s.colorize(rule.severity.color), rule.enabled? ? ENABLED_MARK : DISABLED_MARK})\nif rule_description = colorize_code_fences(rule.description)\n output_paragraph(rule_description)\nend\nif rule_doc = colorize_code_fences(rule.class.parsed_doc)\n output_title(\"Detailed description\")\n output_paragraph(rule_doc)\nend\n"}}]}]},{"html_id":"ameba/Ameba/Reportable","path":"Ameba/Reportable.html","kind":"module","full_name":"Ameba::Reportable","name":"Reportable","abstract":false,"ancestors":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"locations":[{"filename":"src/ameba/reportable.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"}],"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.

","instance_methods":[{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L12"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"if location_disabled?(location, rule)\n status || (status = Issue::Status::Disabled)\nend\n(Issue.new(code, rule, location, end_location, message, status, block)).tap do |issue|\n issues << issue\nend\n"}},{"html_id":"add_issue(rule,location:Crystal::Location|Nil,end_location:Crystal::Location|Nil,message:String,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Crystal::Location | Nil, end_location : Crystal::Location | Nil, message : String, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L27"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"Crystal::Location | ::Nil"},{"name":"end_location","external_name":"end_location","restriction":"Crystal::Location | ::Nil"},{"name":"message","external_name":"message","restriction":"String"},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L53"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token.location, nil, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L63"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"return_type":"Issue","visibility":"Public","body":"location = Crystal::Location.new(path, *location)\nadd_issue(rule, location, nil, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L76"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"}],"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, block)\n"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,block:Source::Corrector->|Nil=nil,*,prefer_name_location=false):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, block : Source::Corrector -> | Nil = nil, *, prefer_name_location = false) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L37"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"block","default_value":"nil","external_name":"block","restriction":"(Source::Corrector ->) | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":5,"return_type":"Issue","visibility":"Public","body":"if prefer_name_location\n location = name_location(node)\nend\nlocation || (location = node.location)\nif prefer_name_location\n end_location = name_end_location(node)\nend\nend_location || (end_location = node.end_location)\nadd_issue(rule, location, end_location, message, status, block)\n"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L71"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, message, status, block)"}},{"html_id":"add_issue(rule,token:Crystal::Token,message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"args_string":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, token : Crystal::Token, message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L58"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"token","external_name":"token","restriction":"Crystal::Token"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, token, message, status, block)"}},{"html_id":"add_issue(rule,location:Tuple(Int32,Int32),end_location:Tuple(Int32,Int32),message,status:Issue::Status|Nil=nil,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","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 = nil, &block : Source::Corrector -> ) : Issue","args_html":"(rule, location : Tuple(Int32, Int32), end_location : Tuple(Int32, Int32), message, status : Issue::Status | Nil = nil, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L91"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"location","external_name":"location","restriction":"::Tuple(Int32, Int32)"},{"name":"end_location","external_name":"end_location","restriction":"::Tuple(Int32, Int32)"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"}],"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, location, end_location, message, status, block)"}},{"html_id":"add_issue(rule,node:Crystal::ASTNode,message,status:Issue::Status|Nil=nil,*,prefer_name_location=false,&block:Source::Corrector->):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","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"args_string":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","args_html":"(rule, node : Crystal::ASTNode, message, status : Issue::Status | Nil = nil, *, prefer_name_location = false, &block : Source::Corrector -> ) : Issue","location":{"filename":"src/ameba/reportable.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L48"},"def":{"name":"add_issue","args":[{"name":"rule","external_name":"rule","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"message","external_name":"message","restriction":""},{"name":"status","default_value":"nil","external_name":"status","restriction":"Issue::Status | ::Nil"},{"name":"","external_name":"","restriction":""},{"name":"prefer_name_location","default_value":"false","external_name":"prefer_name_location","restriction":""}],"splat_index":4,"yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Source::Corrector ->)"},"return_type":"Issue","visibility":"Public","body":"add_issue(rule, node, message, status, block, prefer_name_location: prefer_name_location)"}},{"html_id":"issues-instance-method","name":"issues","doc":"List of reported issues.","summary":"

List of reported issues.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L9"},"def":{"name":"issues","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.

","abstract":false,"location":{"filename":"src/ameba/reportable.cr","line_number":101,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/reportable.cr#L101"},"def":{"name":"valid?","visibility":"Public","body":"issues.none?(&.enabled?)"}}]},{"html_id":"ameba/Ameba/Rule","path":"Ameba/Rule.html","kind":"module","full_name":"Ameba::Rule","name":"Rule","abstract":false,"locations":[{"filename":"src/ameba/rule/base.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"SPECIAL","name":"SPECIAL","value":"{Lint::Syntax.rule_name, Lint::UnneededDisableDirective.rule_name}","doc":"List of names of the special rules, which\nbehave differently than usual rules.","summary":"

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

"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":174,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L174"},"def":{"name":"rules","visibility":"Public","body":"Base.inherited_rules"}}],"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/6d03cef/src/ameba/rule/base.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"GROUP_SEVERITY","name":"GROUP_SEVERITY","value":"{Documentation: Ameba::Severity::Warning, Lint: Ameba::Severity::Warning, Metrics: Ameba::Severity::Warning, Performance: Ameba::Severity::Warning}"}],"included_modules":[{"html_id":"ameba/Ameba/Config/RuleConfig","kind":"module","full_name":"Ameba::Config::RuleConfig","name":"RuleConfig"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation"},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition"},{"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/DebugCalls","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls"},{"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/Formatting","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting"},{"html_id":"ameba/Ameba/Rule/Lint/HashDuplicatedKey","kind":"class","full_name":"Ameba::Rule::Lint::HashDuplicatedKey","name":"HashDuplicatedKey"},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions"},{"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/LiteralsComparison","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison"},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument"},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil"},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang"},{"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/SpecFilename","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename"},{"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/Typos","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos"},{"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/UnusedBlockArgument","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument"},{"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/Naming/AccessorMethodName","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName"},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers"},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName"},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames"},{"html_id":"ameba/Ameba/Rule/Naming/Filename","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename"},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","kind":"class","full_name":"Ameba::Rule::Naming::MethodNames","name":"MethodNames"},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","kind":"class","full_name":"Ameba::Rule::Naming::PredicateName","name":"PredicateName"},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods"},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName"},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","kind":"class","full_name":"Ameba::Rule::Naming::TypeNames","name":"TypeNames"},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames"},{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base"},{"html_id":"ameba/Ameba/Rule/Style/GuardClause","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause"},{"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/NegatedConditionsInUnless","kind":"class","full_name":"Ameba::Rule::Style::NegatedConditionsInUnless","name":"NegatedConditionsInUnless"},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition"},{"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/UnlessElse","kind":"class","full_name":"Ameba::Rule::Style::UnlessElse","name":"UnlessElse"},{"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"}],"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":"default_severity:Ameba::Severity-class-method","name":"default_severity","abstract":false,"def":{"name":"default_severity","return_type":"Ameba::Severity","visibility":"Public","body":"if (value = @@default_severity).nil?\n @@default_severity = (GROUP_SEVERITY[group_name]? || Ameba::Severity::Convention)\nelse\n value\nend"}}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/rule/base.cr","line_number":108,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L108"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"name == other.try(&.name)"}},{"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L53"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.tap do\n test(source)\nend"}},{"html_id":"excluded?(source)-instance-method","name":"excluded?","doc":"Checks whether the source is excluded from this rule.\nIt searches for a path in `excluded` property which matches\nthe one of the given source.\n\n```\nmy_rule.excluded?(source) # => true or false\n```","summary":"

Checks whether the source is excluded from this rule.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/base.cr","line_number":91,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L91"},"def":{"name":"excluded?","args":[{"name":"source","external_name":"source","restriction":""}],"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,"location":{"filename":"src/ameba/rule/base.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L80"},"def":{"name":"group","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.

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L112"},"def":{"name":"hash","visibility":"Public","body":"name.hash"}},{"html_id":"name-instance-method","name":"name","doc":"Returns a name of this rule, which is basically a class name.\n\n```\nclass MyRule < Ameba::Rule::Base\n def test(source)\n end\nend\n\nMyRule.new.name # => \"MyRule\"\n```","summary":"

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

","abstract":false,"location":{"filename":"src/ameba/rule/base.cr","line_number":67,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L67"},"def":{"name":"name","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,"location":{"filename":"src/ameba/rule/base.cr","line_number":104,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L104"},"def":{"name":"special?","visibility":"Public","body":"name.in?(SPECIAL)"}},{"html_id":"test(source:Source,node:Crystal::ASTNode,*opts)-instance-method","name":"test","doc":"NOTE: Can't be abstract","summary":"

NOTE Can't be abstract

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","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":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"},{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"opts","external_name":"opts","restriction":""}],"splat_index":2,"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/base.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source)"}}],"macros":[{"html_id":"issue_for(*args,**kwargs,&block)-macro","name":"issue_for","doc":"Adds an issue to the *source*","summary":"

Adds an issue to the source

","abstract":false,"args":[{"name":"args","external_name":"args","restriction":""}],"args_string":"(*args, **kwargs, &block)","args_html":"(*args, **kwargs, &block)","location":{"filename":"src/ameba/rule/base.cr","line_number":117,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/base.cr#L117"},"def":{"name":"issue_for","args":[{"name":"args","external_name":"args","restriction":""}],"double_splat":{"name":"kwargs","external_name":"kwargs","restriction":""},"splat_index":0,"block_arg":{"name":"block","external_name":"block","restriction":""},"visibility":"Public","body":" source.add_issue(self, \n{{ args.splat }}\n, \n{{ kwargs.double_splat }}\n) \n{{ block }}\n\n \n"}}]},{"html_id":"ameba/Ameba/Rule/Documentation","path":"Ameba/Rule/Documentation.html","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation","abstract":false,"locations":[{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L1"},{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Documentation/Documentation","path":"Ameba/Rule/Documentation/Documentation.html","kind":"class","full_name":"Ameba::Rule::Documentation::Documentation","name":"Documentation","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/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L17"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MACRO_HOOK_NAMES","name":"MACRO_HOOK_NAMES","value":"[\"inherited\", \"included\", \"extended\", \"method_missing\", \"method_added\", \"finished\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Missing documentation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces documentation for public types:\nmodules, classes, enums, methods and macros.\n\nYAML configuration example:\n\n```\nDocumentation/Documentation:\n Enabled: true\n IgnoreClasses: false\n IgnoreModules: true\n IgnoreEnums: false\n IgnoreDefs: true\n IgnoreMacros: false\n IgnoreMacroHooks: true\n```","summary":"

A rule that enforces documentation for public types: modules, classes, enums, methods and macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L17"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_classes=(ignore_classes:Bool)-instance-method","name":"ignore_classes=","abstract":false,"args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"args_string":"(ignore_classes : Bool)","args_html":"(ignore_classes : Bool)","def":{"name":"ignore_classes=","args":[{"name":"ignore_classes","external_name":"ignore_classes","restriction":"Bool"}],"visibility":"Public","body":"@ignore_classes = ignore_classes"}},{"html_id":"ignore_classes?:Bool-instance-method","name":"ignore_classes?","abstract":false,"def":{"name":"ignore_classes?","return_type":"Bool","visibility":"Public","body":"@ignore_classes"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_enums=(ignore_enums:Bool)-instance-method","name":"ignore_enums=","abstract":false,"args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"args_string":"(ignore_enums : Bool)","args_html":"(ignore_enums : Bool)","def":{"name":"ignore_enums=","args":[{"name":"ignore_enums","external_name":"ignore_enums","restriction":"Bool"}],"visibility":"Public","body":"@ignore_enums = ignore_enums"}},{"html_id":"ignore_enums?:Bool-instance-method","name":"ignore_enums?","abstract":false,"def":{"name":"ignore_enums?","return_type":"Bool","visibility":"Public","body":"@ignore_enums"}},{"html_id":"ignore_macro_hooks=(ignore_macro_hooks:Bool)-instance-method","name":"ignore_macro_hooks=","abstract":false,"args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"args_string":"(ignore_macro_hooks : Bool)","args_html":"(ignore_macro_hooks : Bool)","def":{"name":"ignore_macro_hooks=","args":[{"name":"ignore_macro_hooks","external_name":"ignore_macro_hooks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macro_hooks = ignore_macro_hooks"}},{"html_id":"ignore_macro_hooks?:Bool-instance-method","name":"ignore_macro_hooks?","abstract":false,"def":{"name":"ignore_macro_hooks?","return_type":"Bool","visibility":"Public","body":"@ignore_macro_hooks"}},{"html_id":"ignore_macros=(ignore_macros:Bool)-instance-method","name":"ignore_macros=","abstract":false,"args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"args_string":"(ignore_macros : Bool)","args_html":"(ignore_macros : Bool)","def":{"name":"ignore_macros=","args":[{"name":"ignore_macros","external_name":"ignore_macros","restriction":"Bool"}],"visibility":"Public","body":"@ignore_macros = ignore_macros"}},{"html_id":"ignore_macros?:Bool-instance-method","name":"ignore_macros?","abstract":false,"def":{"name":"ignore_macros?","return_type":"Bool","visibility":"Public","body":"@ignore_macros"}},{"html_id":"ignore_modules=(ignore_modules:Bool)-instance-method","name":"ignore_modules=","abstract":false,"args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"args_string":"(ignore_modules : Bool)","args_html":"(ignore_modules : Bool)","def":{"name":"ignore_modules=","args":[{"name":"ignore_modules","external_name":"ignore_modules","restriction":"Bool"}],"visibility":"Public","body":"@ignore_modules = ignore_modules"}},{"html_id":"ignore_modules?:Bool-instance-method","name":"ignore_modules?","abstract":false,"def":{"name":"ignore_modules?","return_type":"Bool","visibility":"Public","body":"@ignore_modules"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ClassDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ClassDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_classes? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::ModuleDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","args_html":"(source, node : Crystal::ModuleDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ModuleDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_modules? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::EnumDef,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::EnumDef, scope : AST::Scope)","args_html":"(source, node : Crystal::EnumDef, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::EnumDef"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_enums? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/documentation/documentation.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_defs? || (check_missing_doc(source, node, scope))"}},{"html_id":"test(source,node:Crystal::Macro,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Macro, scope : AST::Scope)","args_html":"(source, node : Crystal::Macro, scope : AST::Scope)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Macro"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if ignore_macro_hooks? && (node.name.in?(MACRO_HOOK_NAMES))\n return\nend\nignore_macros? || (check_missing_doc(source, node, scope))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Documentation/DocumentationAdmonition","path":"Ameba/Rule/Documentation/DocumentationAdmonition.html","kind":"class","full_name":"Ameba::Rule::Documentation::DocumentationAdmonition","name":"DocumentationAdmonition","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/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Found a %s admonition in a comment\""},{"id":"MSG_ERR","name":"MSG_ERR","value":"\"%s admonition error: %s\""},{"id":"MSG_LATE","name":"MSG_LATE","value":"\"Found a %s admonition in a comment (%s)\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Documentation","kind":"module","full_name":"Ameba::Rule::Documentation","name":"Documentation"},"doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports documentation admonitions.\n\nOptionally, these can fail at an appropriate time.\n\n```\ndef get_user(id)\n # TODO(2024-04-24) Fix this hack when the database migration is complete\n if id < 1_000_000\n v1_api_call(id)\n else\n v2_api_call(id)\n end\nend\n```\n\n`TODO` comments are used to remind yourself of source code related things.\n\nThe premise here is that `TODO` should be dealt with in the near future\nand are therefore reported by Ameba.\n\n`FIXME` comments are used to indicate places where source code needs fixing.\n\nThe premise here is that `FIXME` should indeed be fixed as soon as possible\nand are therefore reported by Ameba.\n\nYAML configuration example:\n\n```\nDocumentation/DocumentationAdmonition:\n Enabled: true\n Admonitions: [TODO, FIXME, BUG]\n Timezone: UTC\n```","summary":"

A rule that reports documentation admonitions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"admonitions:Array(String)-instance-method","name":"admonitions","abstract":false,"def":{"name":"admonitions","visibility":"Public","body":"@admonitions"}},{"html_id":"admonitions=(admonitions:Array(String))-instance-method","name":"admonitions=","abstract":false,"args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"args_string":"(admonitions : Array(String))","args_html":"(admonitions : Array(String))","def":{"name":"admonitions=","args":[{"name":"admonitions","external_name":"admonitions","restriction":"::Array(::String)"}],"visibility":"Public","body":"@admonitions = admonitions"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/documentation/documentation_admonition.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/documentation/documentation_admonition.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"(Tokenizer.new(source)).run do |token|\n if token.type.comment?\n else\n next\n end\n if doc = token.value.to_s\n else\n next\n end\n pattern = /^#\\s*(?#{Regex.union(admonitions)})(?:\\((?.+?)\\))?(?:\\W+|$)/m\n matches = doc.scan(pattern)\n matches.each do |match|\n admonition = match[\"admonition\"]\n begin\n case expr = match[\"context\"]?.presence\n when /\\A\\d{4}-\\d{2}-\\d{2}\\Z/\n date = Time.parse(expr.not_nil!, \"%F\", location)\n issue_for_date(source, token, admonition, date)\n when /\\A\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}(:\\d{2})?\\Z/\n date = Time.parse(expr.not_nil!, \"%F #{$~[1]?.presence ? \"%T\" : \"%R\"}\", location)\n issue_for_date(source, token, admonition, date)\n else\n issue_for(token, MSG % admonition)\n end\n rescue ex\n issue_for(token, MSG_ERR % {admonition, \"#{ex}: #{expr.inspect}\"})\n end\n end\nend"}},{"html_id":"timezone:String-instance-method","name":"timezone","abstract":false,"def":{"name":"timezone","return_type":"String","visibility":"Public","body":"@timezone"}},{"html_id":"timezone=(timezone:String)-instance-method","name":"timezone=","abstract":false,"args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"args_string":"(timezone : String)","args_html":"(timezone : String)","def":{"name":"timezone=","args":[{"name":"timezone","external_name":"timezone","restriction":"String"}],"visibility":"Public","body":"@timezone = timezone"}}]}]},{"html_id":"ameba/Ameba/Rule/Layout","path":"Ameba/Rule/Layout.html","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout","abstract":false,"locations":[{"filename":"src/ameba/rule/layout/line_length.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/6d03cef/src/ameba/rule/layout/line_length.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Line too long\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows lines longer than `max_length` number of symbols.\n\nYAML configuration example:\n\n```\nLayout/LineLength:\n Enabled: true\n MaxLength: 100\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/layout/line_length.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Int32-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"Int32","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Int32)-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"args_string":"(max_length : Int32)","args_html":"(max_length : Int32)","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"Int32"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/layout/line_length.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/layout/line_length.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if line.size > max_length\n issue_for({index + 1, max_length + 1}, MSG)\n end\nend"}}]},{"html_id":"ameba/Ameba/Rule/Layout/TrailingBlankLines","path":"Ameba/Rule/Layout/TrailingBlankLines.html","kind":"class","full_name":"Ameba::Rule::Layout::TrailingBlankLines","name":"TrailingBlankLines","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_blank_lines.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/layout/trailing_blank_lines.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Excessive trailing newline detected\""},{"id":"MSG_FINAL_NEWLINE","name":"MSG_FINAL_NEWLINE","value":"\"Trailing newline missing\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing blank lines at the end of the source file.\n\nYAML configuration example:\n\n```\nLayout/TrailingBlankLines:\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/layout/trailing_blank_lines.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/layout/trailing_blank_lines.cr#L18"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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.zero? || ((source_lines.last(2)).join.presence && last_line_empty)\n return\nend\nif last_line_empty\n issue_for({source_lines_size, 1}, MSG)\nelse\n issue_for({source_lines_size, 1}, MSG_FINAL_NEWLINE) do |corrector|\n corrector.insert_before({source_lines_size + 1, 1}, '\\n')\n end\nend\n"}}]},{"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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Trailing whitespace detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Layout","kind":"module","full_name":"Ameba::Rule::Layout","name":"Layout"},"doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows trailing whitespace.\n\nYAML configuration example:\n\n```\nLayout/TrailingWhitespace:\n Enabled: true\n```","summary":"

A rule that disallows trailing whitespace.

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/layout/trailing_whitespace.cr#L17"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.lines.each_with_index do |line, index|\n if ws_index = line =~ (/\\s+$/)\n else\n next\n end\n location = {index + 1, ws_index + 1}\n end_location = {index + 1, line.size}\n issue_for(location, end_location, MSG) do |corrector|\n corrector.remove(location, end_location)\n end\nend"}}]}]},{"html_id":"ameba/Ameba/Rule/Lint","path":"Ameba/Rule/Lint.html","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint","abstract":false,"locations":[{"filename":"src/ameba/rule/lint/ambiguous_assignment.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L1"},{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L1"},{"filename":"src/ameba/rule/lint/debugger_statement.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L1"},{"filename":"src/ameba/rule/lint/formatting.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L3"},{"filename":"src/ameba/rule/lint/hash_duplicated_key.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L1"},{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L1"},{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L1"},{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L1"},{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L1"},{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L1"},{"filename":"src/ameba/rule/lint/percent_array.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L1"},{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L1"},{"filename":"src/ameba/rule/lint/shared_var_in_fiber.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L1"},{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L3"},{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/src/ameba/rule/lint/syntax.cr#L1"},{"filename":"src/ameba/rule/lint/typos.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L1"},{"filename":"src/ameba/rule/lint/unneeded_disable_directive.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/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/6d03cef/src/ameba/rule/lint/unused_argument.cr#L1"},{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L1"},{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/ambiguous_assignment.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MISTAKES","name":"MISTAKES","value":"{\"=-\": \"-=\", \"=+\": \"+=\", \"=!\": \"!=\"}"},{"id":"MSG","name":"MSG","value":"\"Suspicious assignment detected. Did you mean `%s`?\""}],"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"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\n\nYAML configuration example:\n\n```\nLint/AmbiguousAssignment:\n Enabled: true\n```","summary":"

This rule checks for mistyped shorthand assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\nThis is considered invalid:\n\n```\nx = -y\nx = +y\nx = !y\n```\n\nAnd this is valid:\n\n```\nx -= y # or x = -y\nx += y # or x = +y\nx != y # or x = !y\n```\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","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":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/ambiguous_assignment.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/ambiguous_assignment.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"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 suggestion = MISTAKES[op_text]?\nelse\n return\nend\nissue_for(op_location, op_end_location, MSG % suggestion)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/bad_directive.cr#L20"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALL_GROUP_NAMES","name":"ALL_GROUP_NAMES","value":"Rule.rules.map(&.group_name).uniq!"},{"id":"ALL_RULE_NAMES","name":"ALL_RULE_NAMES","value":"Rule.rules.map(&.rule_name)"},{"id":"AVAILABLE_ACTIONS","name":"AVAILABLE_ACTIONS","value":"InlineComments::Action.names.map(&.downcase)"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/bad_directive.cr#L20"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/bad_directive.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/comparison_to_boolean.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison to a boolean is pointless\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"==\", \"!=\", \"===\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/comparison_to_boolean.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif node.args.size == 1\nelse\n return\nend\narg, obj = node.args.first, node.obj\ncase\nwhen arg.is_a?(Crystal::BoolLiteral)\n bool, exp = arg, obj\nwhen obj.is_a?(Crystal::BoolLiteral)\n bool, exp = obj, arg\nend\nif bool && exp\nelse\n return\nend\nif exp_code = node_source(exp, source.lines)\nelse\n return\nend\nnot = case node.name\nwhen \"==\", \"===\"\n !bool.value\nwhen \"!=\"\n bool.value\nend\nif not\n exp_code = \"!#{exp_code}\"\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/DebugCalls","path":"Ameba/Rule/Lint/DebugCalls.html","kind":"class","full_name":"Ameba::Rule::Lint::DebugCalls","name":"DebugCalls","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/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possibly forgotten debug-related `%s` call detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows calls to debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 debug-related methods.\n\nThis is because we don't want debug calls accidentally being\ncommitted into our codebase.\n\nYAML configuration example:\n\n```\nLint/DebugCalls:\n Enabled: true\n MethodNames:\n - p\n - p!\n - pp\n - pp!\n```","summary":"

A rule that disallows calls to debug-related methods.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":18,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"method_names:Array(String)-instance-method","name":"method_names","abstract":false,"def":{"name":"method_names","visibility":"Public","body":"@method_names"}},{"html_id":"method_names=(method_names:Array(String))-instance-method","name":"method_names=","abstract":false,"args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"args_string":"(method_names : Array(String))","args_html":"(method_names : Array(String))","def":{"name":"method_names=","args":[{"name":"method_names","external_name":"method_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@method_names = method_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/debug_calls.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/debug_calls.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(method_names)) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG % node.name)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/debugger_statement.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Possible forgotten debugger statement detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/debugger_statement.cr#L13"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/debugger_statement.cr#L20"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name == \"debugger\") && node.args.empty?) && node.obj.nil?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/duplicated_require.cr#L16"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated require of `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/duplicated_require.cr#L16"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/duplicated_require.cr#L23"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"nodes = (AST::TopLevelNodesVisitor.new(source.ast)).require_nodes\nnodes.each_with_object([] of String) do |node, processed_require_strings|\n if node.string.in?(processed_require_strings)\n issue_for(node, MSG % node.string)\n end\n processed_require_strings << node.string\nend\n"}}]},{"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":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_ensure.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty `ensure` block detected\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","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":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_ensure.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_ensure.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node_ensure = node.ensure\nif node_ensure.nil? || (!node_ensure.nop?)\n return\nend\nissue_for(node.ensure_location, node.end_location, MSG)\n"}}]},{"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/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/6d03cef/src/ameba/rule/lint/empty_expression.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid empty expressions\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/empty_expression.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Expressions)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_expression.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Expressions"}],"visibility":"Public","body":"if (node.expressions.size == 1) && node.expressions.first.nop?\nelse\n return\nend\nissue_for(node, MSG)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Empty loop detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/empty_loop.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if loop?(node)\n check_node(source, node, node.block)\nend"}},{"html_id":"test(source,node:Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/empty_loop.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/empty_loop.cr#L53"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if literal?(node.cond)\n check_node(source, node, node.body)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Formatting","path":"Ameba/Rule/Lint/Formatting.html","kind":"class","full_name":"Ameba::Rule::Lint::Formatting","name":"Formatting","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/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use built-in formatter to format this source\""},{"id":"MSG_ERROR","name":"MSG_ERROR","value":"\"Error while formatting: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that verifies syntax formatting according to the\nCrystal's built-in formatter.\n\nFor example, this syntax is invalid:\n\n def foo(a,b,c=0)\n #foobar\n a+b+c\n end\n\nAnd should be properly written:\n\n def foo(a, b, c = 0)\n # foobar\n a + b + c\n end\n\nYAML configuration example:\n\n```\nLint/Formatting:\n Enabled: true\n FailOnError: false\n```","summary":"

A rule that verifies syntax formatting according to the Crystal's built-in formatter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/formatting.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/formatting.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"begin\n source_code = source.code\n result = Crystal.format(source_code, source.path)\n if result == source_code\n return\n end\n source_lines = source_code.lines\n if source_lines.empty?\n return\n end\n end_location = {source_lines.size, source_lines.last.size + 1}\n issue_for(LOCATION, MSG) do |corrector|\n corrector.replace(LOCATION, end_location, result)\n end\nrescue ex : Crystal::SyntaxException\n if fail_on_error?\n issue_for({ex.line_number, ex.column_number}, MSG_ERROR % ex.message)\n end\nrescue ex\n if fail_on_error?\n issue_for(LOCATION, MSG_ERROR % ex.message)\n end\nend"}}]},{"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/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Duplicated keys in hash literal: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::HashLiteral)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/hash_duplicated_key.cr#L29"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::HashLiteral"}],"visibility":"Public","body":"if (keys = duplicated_keys(node.entries)).empty?\n return\nend\nissue_for(node, MSG % (keys.join(\", \")))\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralAssignmentsInExpressions","path":"Ameba/Rule/Lint/LiteralAssignmentsInExpressions.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralAssignmentsInExpressions","name":"LiteralAssignmentsInExpressions","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_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Detected assignment with a literal value in control expression\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows assignments with literal values\nin control expressions.\n\nFor example, this is considered invalid:\n\n```\nif foo = 42\n do_something\nend\n```\n\nAnd most likely should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nLint/LiteralAssignmentsInExpressions:\n Enabled: true\n```","summary":"

A rule that disallows assignments with literal values in control expressions.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/lint/literal_assignments_in_expressions.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_assignments_in_expressions.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"if (cond = node.cond).is_a?(Crystal::Assign)\nelse\n return\nend\nif literal?(cond.value)\nelse\n return\nend\nissue_for(cond, MSG)\n"}}]},{"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":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_in_condition.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in conditional\""}],"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"}],"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\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_in_condition.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case)","location":{"filename":"src/ameba/rule/lint/literal_in_condition.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literal_in_condition.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case"}],"visibility":"Public","body":"if static_literal?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L18"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Literal value found in interpolation\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L18"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/literal_in_interpolation.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"node.expressions.select do |exp|\n (!exp.is_a?(Crystal::StringLiteral)) && (literal?(exp))\nend.each do |exp|\n issue_for(exp, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Lint/LiteralsComparison","path":"Ameba/Rule/Lint/LiteralsComparison.html","kind":"class","full_name":"Ameba::Rule::Lint::LiteralsComparison","name":"LiteralsComparison","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/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L19"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Comparison always evaluates to %s\""},{"id":"MSG_LIKELY","name":"MSG_LIKELY","value":"\"Comparison most likely evaluates to %s\""},{"id":"OP_NAMES","name":"OP_NAMES","value":"[\"===\", \"==\", \"!=\"] of ::String"}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 comparisons between two literals.\n\nThey usually have the same result - except for non-primitive\ntypes like containers, range or regex.\n\nFor example, this will be always false:\n\n```\n\"foo\" == 42\n```\n\nYAML configuration example:\n\n```\nLint/LiteralsComparison:\n Enabled: true\n```","summary":"

This rule is used to identify comparisons between two literals.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L19"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/literals_comparison.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/literals_comparison.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(OP_NAMES)\nelse\n return\nend\nif (obj = node.obj) && (arg = node.args.first?)\nelse\n return\nend\nobj_is_literal, obj_is_static = literal_kind?(obj)\narg_is_literal, arg_is_static = literal_kind?(arg)\nif obj_is_literal && arg_is_literal\nelse\n return\nend\nif obj.to_s == arg.to_s\nelse\n return\nend\nis_dynamic = (!obj_is_static) || (!arg_is_static)\nwhat = case node.name\nwhen \"===\"\n \"the same\"\nwhen \"==\"\n \"true\"\nwhen \"!=\"\n \"false\"\nend\nissue_for(node, (is_dynamic ? MSG_LIKELY : MSG) % what)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/MissingBlockArgument","path":"Ameba/Rule/Lint/MissingBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::MissingBlockArgument","name":"MissingBlockArgument","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/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Missing anonymous block argument. Use `&` as an argument name to indicate yielding method.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows yielding method definitions without block argument.\n\nFor example, this is considered invalid:\n\n def foo\n yield 42\n end\n\nAnd has to be written as the following:\n\n def foo(&)\n yield 42\n end\n\nYAML configuration example:\n\n```\nLint/MissingBlockArgument:\n Enabled: true\n```","summary":"

A rule that disallows yielding method definitions without block argument.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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/missing_block_argument.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if (!scope.yields?) || node.block_arg\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/missing_block_argument.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/missing_block_argument.cr#L30"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNil","path":"Ameba/Rule/Lint/NotNil.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNil","name":"NotNil","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/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid using `not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 usages of `not_nil!` calls.\n\nFor example, this is considered a code smell:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }.not_nil!\n```\n\nAnd can be written as this:\n\n```\nnames = %w[Alice Bob]\nalice = names.find { |name| name == \"Alice\" }\n\nif alice\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/NotNil:\n Enabled: true\n```","summary":"

This rule is used to identify usages of not_nil! calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"not_nil!\"\nelse\n return\nend\nif node.obj && node.args.empty?\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/NotNilAfterNoBang","path":"Ameba/Rule/Lint/NotNilAfterNoBang.html","kind":"class","full_name":"Ameba::Rule::Lint::NotNilAfterNoBang","name":"NotNilAfterNoBang","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/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BLOCK_CALL_NAMES","name":"BLOCK_CALL_NAMES","value":"[\"index\", \"rindex\", \"find\"] of ::String"},{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"index\", \"rindex\", \"match\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s! {...}` instead of `%s {...}.not_nil!`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"This rule is used to identify usage of `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `index/rindex/find/match` calls\nfollowed by a call to `not_nil!`.\n\nFor example, this is considered a code smell:\n\n```\n%w[Alice Bob].find(&.chars.any?(&.in?('o', 'b'))).not_nil!\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].find!(&.chars.any?(&.in?('o', 'b')))\n```\n\nYAML configuration example:\n\n```\nLint/NotNilAfterNoBang:\n Enabled: true\n```","summary":"

This rule is used to identify usage of index/rindex/find/match calls followed by a call to not_nil!.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"not_nil!\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.name.in?(obj.block ? BLOCK_CALL_NAMES : CALL_NAMES)\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif name_location_end = name_end_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {obj.name, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.insert_after(name_location_end, '!')\n corrector.remove_trailing(node, {{ \".not_nil!\".size }})\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/not_nil_after_no_bang.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/not_nil_after_no_bang.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/6d03cef/src/ameba/rule/lint/percent_array.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Symbols `%s` may be unwanted in %s array literals\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/percent_array.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"string_array_unwanted_symbols:String-instance-method","name":"string_array_unwanted_symbols","abstract":false,"def":{"name":"string_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"args_string":"(string_array_unwanted_symbols : String)","args_html":"(string_array_unwanted_symbols : String)","def":{"name":"string_array_unwanted_symbols=","args":[{"name":"string_array_unwanted_symbols","external_name":"string_array_unwanted_symbols","restriction":"String"}],"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","abstract":false,"def":{"name":"symbol_array_unwanted_symbols","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=","abstract":false,"args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"args_string":"(symbol_array_unwanted_symbols : String)","args_html":"(symbol_array_unwanted_symbols : String)","def":{"name":"symbol_array_unwanted_symbols=","args":[{"name":"symbol_array_unwanted_symbols","external_name":"symbol_array_unwanted_symbols","restriction":"String"}],"visibility":"Public","body":"@symbol_array_unwanted_symbols = symbol_array_unwanted_symbols"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/percent_array.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 = start_token) && (!issue)\n issue = array_entry_invalid?(token.value.to_s, _start.raw)\n end\n when .string_array_end?\n if (_start = start_token) && (_issue = issue)\n issue_for(_start, _issue)\n end\n issue = start_token = nil\n end\nend\n"}}]},{"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/6d03cef/src/ameba/rule/lint/rand_zero.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"%s always returns 0\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows `rand(0)` and `rand(1)` calls.\nSuch calls always return `0`.\n\nFor example:\n\n```\nrand(1)\n```\n\nShould be written as:\n\n```\nrand\n# or\nrand(2)\n```\n\nYAML configuration example:\n\n```\nLint/RandZero:\n Enabled: true\n```","summary":"

A rule that disallows rand(0) and rand(1) calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/rand_zero.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/rand_zero.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/rand_zero.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name == \"rand\") && (node.args.size == 1)) && (arg = node.args.first).is_a?(Crystal::NumberLiteral)) && (arg.value.in?(\"0\", \"1\"))\nelse\n return\nend\nissue_for(node, MSG % node)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantStringCoercion","path":"Ameba/Rule/Lint/RedundantStringCoercion.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantStringCoercion","name":"RedundantStringCoercion","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/redundant_string_coercion.cr","line_number":23,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_string_coercion.cr#L23"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant use of `Object#to_s` in interpolation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows string conversion in string interpolation,\nwhich is redundant.\n\nFor example, this is considered invalid:\n\n```\n\"Hello, #{name.to_s}\"\n```\n\nAnd this is valid:\n\n```\n\"Hello, #{name}\"\n```\n\nYAML configuration example:\n\n```\nLint/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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/RedundantStringCoercion\n Enabled: true\n```","summary":"

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

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/lint/redundant_string_coercion.cr#L23"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::StringInterpolation)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/redundant_string_coercion.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::StringInterpolation"}],"visibility":"Public","body":"(string_coercion_nodes(node)).each do |expr|\n issue_for(name_location(expr), expr.end_location, MSG)\nend"}}]},{"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":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_index.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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\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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `with_index` calls.\n\nFor example, this is considered invalid:\n\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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_index.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_index.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_index.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"args, block = node.args, node.block\nif block.nil? || args.size > 1\n return\nend\nif with_index_arg?(block)\n return\nend\ncase node.name\nwhen \"with_index\"\n report(source, node, \"Remove redundant with_index\")\nwhen \"each_with_index\"\n report(source, node, \"Use each instead of each_with_index\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/RedundantWithObject","path":"Ameba/Rule/Lint/RedundantWithObject.html","kind":"class","full_name":"Ameba::Rule::Lint::RedundantWithObject","name":"RedundantWithObject","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_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_object.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `each` instead of `each_with_object`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows redundant `each_with_object` calls.\n\nFor example, this is considered invalid:\n\n```\ncollection.each_with_object(0) do |e|\n # ...\nend\n\ncollection.each_with_object(0) do |e, _|\n # ...\nend\n```\n\nand it should be written as follows:\n\n```\ncollection.each do |e|\n # ...\nend\n```\n\nYAML configuration example:\n\n```\nLint/RedundantWithObject:\n Enabled: true\n```","summary":"

A rule that disallows redundant each_with_object calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_object.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/lint/redundant_with_object.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/redundant_with_object.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (((node.name != \"each_with_object\") || (node.args.size != 1)) || (!(block = node.block))) || (with_index_arg?(block))\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Lint/ShadowedArgument","path":"Ameba/Rule/Lint/ShadowedArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::ShadowedArgument","name":"ShadowedArgument","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_argument.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Argument `%s` is assigned before it is used\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that disallows shadowed arguments.\n\nFor example, this is considered invalid:\n\n```\ndo_something do |foo|\n foo = 1 # shadows block argument\n foo\nend\n\ndef do_something(foo)\n foo = 1 # shadows method argument\n foo\nend\n```\n\nand it should be written as follows:\n\n```\ndo_something do |foo|\n foo = foo + 42\n foo\nend\n\ndef do_something(foo)\n foo = foo + 42\n foo\nend\n```\n\nYAML configuration example:\n\n```\nLint/ShadowedArgument:\n Enabled: true\n```","summary":"

A rule that disallows shadowed arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/shadowed_argument.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L36"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowed exception found: %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L36"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/shadowed_exception.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"rescues = node.rescues\nif rescues.nil?\n return\nend\n(shadowed(rescues)).each do |path|\n issue_for(path, MSG % (path.names.join(\"::\")))\nend\n"}}]},{"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_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shadowing outer local variable `%s`\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral|Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral | Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral | Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"find_shadowing(source, scope)"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/shadowing_outer_local_var.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/shadowing_outer_local_var.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source, skip: [Crystal::Macro, Crystal::MacroFor])"}}]},{"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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Shared variable `%s` is used in fiber\""}],"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"}],"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 techniques 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 techniques 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","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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L52"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L63"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"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","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/shared_var_in_fiber.cr#L59"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/SpecFilename","path":"Ameba/Rule/Lint/SpecFilename.html","kind":"class","full_name":"Ameba::Rule::Lint::SpecFilename","name":"SpecFilename","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_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L14"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Spec filename should have `_spec` suffix: %s.cr, not %s.cr\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces spec filenames to have `_spec` suffix.\n\nYAML configuration example:\n\n```\nLint/SpecFilename:\n Enabled: true\n IgnoredDirs: [spec/support spec/fixtures spec/data]\n IgnoredFilenames: [spec_helper]\n```","summary":"

A rule that enforces spec filenames to have _spec suffix.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L14"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignored_dirs:Array(String)-instance-method","name":"ignored_dirs","abstract":false,"def":{"name":"ignored_dirs","visibility":"Public","body":"@ignored_dirs"}},{"html_id":"ignored_dirs=(ignored_dirs:Array(String))-instance-method","name":"ignored_dirs=","abstract":false,"args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"args_string":"(ignored_dirs : Array(String))","args_html":"(ignored_dirs : Array(String))","def":{"name":"ignored_dirs=","args":[{"name":"ignored_dirs","external_name":"ignored_dirs","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_dirs = ignored_dirs"}},{"html_id":"ignored_filenames:Array(String)-instance-method","name":"ignored_filenames","abstract":false,"def":{"name":"ignored_filenames","visibility":"Public","body":"@ignored_filenames"}},{"html_id":"ignored_filenames=(ignored_filenames:Array(String))-instance-method","name":"ignored_filenames=","abstract":false,"args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"args_string":"(ignored_filenames : Array(String))","args_html":"(ignored_filenames : Array(String))","def":{"name":"ignored_filenames=","args":[{"name":"ignored_filenames","external_name":"ignored_filenames","restriction":"::Array(::String)"}],"visibility":"Public","body":"@ignored_filenames = ignored_filenames"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source:Source)-instance-method","name":"test","doc":"TODO: fix the assumption that *source.path* contains relative path","summary":"

TODO fix the assumption that source.path contains relative path

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/spec_filename.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_filename.cr#L26"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path_ = Path[source.path].to_posix\nname = path_.stem\npath = path_.to_s\nif path.starts_with?(\"spec/\")\nelse\n return\nend\nif path.ends_with?(\".cr\")\nelse\n return\nend\nif name.ends_with?(\"_spec\")\n return\nend\nignored_dirs.each do |substr|\n if path.starts_with?(\"#{substr}/\")\n return\n end\nend\nif name.in?(ignored_filenames)\n return\nend\nexpected = \"#{name}_spec\"\nissue_for(LOCATION, MSG % {expected, name}) do\n new_path = path_.sibling(expected + path_.extension)\n FileUtils.mv(path, new_path)\nend\n"}}]},{"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/6d03cef/src/ameba/rule/lint/spec_focus.cr#L47"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Focused spec item detected\""},{"id":"SPEC_ITEM_NAMES","name":"SPEC_ITEM_NAMES","value":"[\"describe\", \"context\", \"it\", \"pending\"] of ::String"}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/spec_focus.cr#L47"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":62,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_focus.cr#L62"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nelse\n return\nend\nissue_for(arg, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/spec_focus.cr","line_number":56,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/spec_focus.cr#L56"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"if source.spec?\nelse\n return\nend\nAST::NodeVisitor.new(self, source)\n"}}]},{"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/6d03cef/src/ameba/rule/lint/syntax.cr#L21"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/syntax.cr#L21"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","return_type":"Ameba::Severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/syntax.cr#L27"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"html_id":"ameba/Ameba/Rule/Lint/Typos","path":"Ameba/Rule/Lint/Typos.html","kind":"class","full_name":"Ameba::Rule::Lint::Typos","name":"Typos","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/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"BIN_PATH","name":"BIN_PATH","value":"Process.find_executable(\"typos\")"},{"id":"MSG","name":"MSG","value":"\"Typo found: %s -> %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports typos found in source files.\n\nNOTE: Needs [typos](https://github.com/crate-ci/typos) CLI tool.\nNOTE: See the chapter on [false positives](https://github.com/crate-ci/typos#false-positives).\n\nYAML configuration example:\n\n```\nLint/Typos:\n Enabled: true\n BinPath: ~\n FailOnError: false\n```","summary":"

A rule that reports typos found in source files.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L15"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"bin_path:String|Nil-instance-method","name":"bin_path","abstract":false,"location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L27"},"def":{"name":"bin_path","return_type":"String | ::Nil","visibility":"Public","body":"@bin_path || BIN_PATH"}},{"html_id":"bin_path=(bin_path:Union(String,Nil))-instance-method","name":"bin_path=","abstract":false,"args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"args_string":"(bin_path : Union(String, Nil))","args_html":"(bin_path : Union(String, Nil))","def":{"name":"bin_path=","args":[{"name":"bin_path","external_name":"bin_path","restriction":"::Union(String, ::Nil)"}],"visibility":"Public","body":"@bin_path = bin_path"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"fail_on_error=(fail_on_error:Bool)-instance-method","name":"fail_on_error=","abstract":false,"args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"args_string":"(fail_on_error : Bool)","args_html":"(fail_on_error : Bool)","def":{"name":"fail_on_error=","args":[{"name":"fail_on_error","external_name":"fail_on_error","restriction":"Bool"}],"visibility":"Public","body":"@fail_on_error = fail_on_error"}},{"html_id":"fail_on_error?:Bool-instance-method","name":"fail_on_error?","abstract":false,"def":{"name":"fail_on_error?","return_type":"Bool","visibility":"Public","body":"@fail_on_error"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/lint/typos.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/typos.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"begin\n typos = typos_from(source)\n typos.try(&.each do |typo|\n corrections = typo.corrections\n message = MSG % {typo.typo, corrections.join(\" | \")}\n if corrections.size == 1\n issue_for(typo.location, typo.end_location, message) do |corrector|\n corrector.replace(typo.location, typo.end_location, corrections.first)\n end\n else\n issue_for(typo.location, typo.end_location, message)\n end\n end)\nrescue ex\n if fail_on_error?\n raise(ex)\n end\nend"}}]},{"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/6d03cef/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unnecessary disabling of %s\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/unneeded_disable_directive.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/lint/unneeded_disable_directive.cr#L34"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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"}}]},{"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/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/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L44"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Unreachable code detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L44"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,flow_expression:AST::FlowExpression)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","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":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"flow_expression","external_name":"flow_expression","restriction":"AST::FlowExpression"}],"visibility":"Public","body":"if unreachable_node = flow_expression.unreachable_nodes.first?\nelse\n return\nend\nissue_for(unreachable_node, MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unreachable_code.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unreachable_code.cr#L51"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::FlowExpressionVisitor.new(self, source)"}}]},{"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":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"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.\""}],"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"}],"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```\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\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","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_blocks=(ignore_blocks:Bool)-instance-method","name":"ignore_blocks=","abstract":false,"args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"args_string":"(ignore_blocks : Bool)","args_html":"(ignore_blocks : Bool)","def":{"name":"ignore_blocks=","args":[{"name":"ignore_blocks","external_name":"ignore_blocks","restriction":"Bool"}],"visibility":"Public","body":"@ignore_blocks = ignore_blocks"}},{"html_id":"ignore_blocks?:Bool-instance-method","name":"ignore_blocks?","abstract":false,"def":{"name":"ignore_blocks?","return_type":"Bool","visibility":"Public","body":"@ignore_blocks"}},{"html_id":"ignore_defs=(ignore_defs:Bool)-instance-method","name":"ignore_defs=","abstract":false,"args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"args_string":"(ignore_defs : Bool)","args_html":"(ignore_defs : Bool)","def":{"name":"ignore_defs=","args":[{"name":"ignore_defs","external_name":"ignore_defs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_defs = ignore_defs"}},{"html_id":"ignore_defs?:Bool-instance-method","name":"ignore_defs?","abstract":false,"def":{"name":"ignore_defs?","return_type":"Bool","visibility":"Public","body":"@ignore_defs"}},{"html_id":"ignore_procs=(ignore_procs:Bool)-instance-method","name":"ignore_procs=","abstract":false,"args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"args_string":"(ignore_procs : Bool)","args_html":"(ignore_procs : Bool)","def":{"name":"ignore_procs=","args":[{"name":"ignore_procs","external_name":"ignore_procs","restriction":"Bool"}],"visibility":"Public","body":"@ignore_procs = ignore_procs"}},{"html_id":"ignore_procs?:Bool-instance-method","name":"ignore_procs?","abstract":false,"def":{"name":"ignore_procs?","return_type":"Bool","visibility":"Public","body":"@ignore_procs"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ProcLiteral,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","args_html":"(source, node : Crystal::ProcLiteral, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L44"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ProcLiteral"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_procs? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Block,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Block, scope : AST::Scope)","args_html":"(source, node : Crystal::Block, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":48,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L48"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"ignore_blocks? || (find_unused_arguments(source, scope))"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"args_string":"(source, node : Crystal::Def, scope : AST::Scope)","args_html":"(source, node : Crystal::Def, scope : AST::Scope)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"arguments = scope.arguments.dup\nif block_arg = node.block_arg\n arguments.reject!() do |__arg0|\n __arg0.node == block_arg\n end\nend\nignore_defs? || (find_unused_arguments(source, scope, arguments))\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_argument.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_argument.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"html_id":"ameba/Ameba/Rule/Lint/UnusedBlockArgument","path":"Ameba/Rule/Lint/UnusedBlockArgument.html","kind":"class","full_name":"Ameba::Rule::Lint::UnusedBlockArgument","name":"UnusedBlockArgument","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_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_UNUSED","name":"MSG_UNUSED","value":"\"Unused block argument `%1$s`. If it's necessary, use `_%1$s` as an argument name to indicate that it won't be used.\""},{"id":"MSG_YIELDED","name":"MSG_YIELDED","value":"\"Use `&` as an argument name to indicate that it won't be referenced.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Lint","kind":"module","full_name":"Ameba::Rule::Lint","name":"Lint"},"doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports unused block arguments.\nFor example, this is considered invalid:\n\n```\ndef foo(a, b, &block)\n a + b\nend\n\ndef bar(&block)\n yield 42\nend\n```\n\nand should be written as:\n\n```\ndef foo(a, b, &_block)\n a + b\nend\n\ndef bar(&)\n yield 42\nend\n```\n\nYAML configuration example:\n\n```\nLint/UnusedBlockArgument:\n Enabled: true\n```","summary":"

A rule that reports unused block arguments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","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_block_argument.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if node.abstract?\n return\nend\nif block_arg = node.block_arg\nelse\n return\nend\nif block_arg = scope.arguments.find() do |__arg0|\n __arg0.node == block_arg\nend\nelse\n return\nend\nif block_arg.anonymous?\n return\nend\nif scope.references?(block_arg.variable)\n return\nend\nlocation = block_arg.node.location\nend_location = location.try(&.adjust(column_number: block_arg.name.size - 1))\ncase\nwhen scope.yields?\n if location && end_location\n issue_for(location, end_location, MSG_YIELDED) do |corrector|\n corrector.remove(location, end_location)\n end\n else\n issue_for(block_arg.node, MSG_YIELDED)\n end\nwhen !block_arg.ignored?\n if location && end_location\n issue_for(location, end_location, MSG_UNUSED % block_arg.name) do |corrector|\n corrector.insert_before(location, '_')\n end\n else\n issue_for(block_arg.node, MSG_UNUSED % block_arg.name)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/unused_block_argument.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/unused_block_argument.cr#L43"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless assignment to variable `%s`\""}],"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"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeTypeDeclarations: false\n```","summary":"

A rule that disallows useless assignments.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_type_declarations=(exclude_type_declarations:Bool)-instance-method","name":"exclude_type_declarations=","abstract":false,"args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"args_string":"(exclude_type_declarations : Bool)","args_html":"(exclude_type_declarations : Bool)","def":{"name":"exclude_type_declarations=","args":[{"name":"exclude_type_declarations","external_name":"exclude_type_declarations","restriction":"Bool"}],"visibility":"Public","body":"@exclude_type_declarations = exclude_type_declarations"}},{"html_id":"exclude_type_declarations?:Bool-instance-method","name":"exclude_type_declarations?","abstract":false,"def":{"name":"exclude_type_declarations?","return_type":"Bool","visibility":"Public","body":"@exclude_type_declarations"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node,scope:AST::Scope)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","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":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":""},{"name":"scope","external_name":"scope","restriction":"AST::Scope"}],"visibility":"Public","body":"if scope.lib_def?(check_outer_scopes: true)\n return\nend\nscope.variables.each do |var|\n if (var.ignored? || var.used_in_macro?) || var.captured_by_block?\n next\n end\n if exclude_type_declarations? && (scope.assigns_type_dec?(var.name))\n next\n end\n var.assignments.each do |assign|\n check_assignment(source, assign, var)\n end\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/lint/useless_assign.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/lint/useless_assign.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::ScopeVisitor.new(self, source)"}}]},{"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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L33"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Useless condition in when detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L33"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::When)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/lint/useless_condition_in_when.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::When"}],"visibility":"Public","body":"ConditionInWhenVisitor.new(self, source, node)"}}]}]},{"html_id":"ameba/Ameba/Rule/Metrics","path":"Ameba/Rule/Metrics.html","kind":"module","full_name":"Ameba::Rule::Metrics","name":"Metrics","abstract":false,"locations":[{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"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/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Cyclomatic complexity too high [%d/%d]\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows methods with a cyclomatic complexity higher than `MaxComplexity`\n\nYAML configuration example:\n\n```\nMetrics/CyclomaticComplexity:\n Enabled: true\n MaxComplexity: 10\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L11"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_complexity:Int32-instance-method","name":"max_complexity","abstract":false,"def":{"name":"max_complexity","return_type":"Int32","visibility":"Public","body":"@max_complexity"}},{"html_id":"max_complexity=(max_complexity:Int32)-instance-method","name":"max_complexity=","abstract":false,"args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"args_string":"(max_complexity : Int32)","args_html":"(max_complexity : Int32)","def":{"name":"max_complexity=","args":[{"name":"max_complexity","external_name":"max_complexity","restriction":"Int32"}],"visibility":"Public","body":"@max_complexity = max_complexity"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/metrics/cyclomatic_complexity.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/metrics/cyclomatic_complexity.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"complexity = (AST::CountingVisitor.new(node)).count\nif complexity > max_complexity\nelse\n return\nend\nissue_for(node, MSG % {complexity, max_complexity}, prefer_name_location: true)\n"}}]}]},{"html_id":"ameba/Ameba/Rule/Naming","path":"Ameba/Rule/Naming.html","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming","abstract":false,"locations":[{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L1"},{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L1"},{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L1"},{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L1"},{"filename":"src/ameba/rule/naming/filename.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L1"},{"filename":"src/ameba/rule/naming/method_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L1"},{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L1"},{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L1"},{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L1"},{"filename":"src/ameba/rule/naming/type_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L1"},{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Naming/AccessorMethodName","path":"Ameba/Rule/Naming/AccessorMethodName.html","kind":"class","full_name":"Ameba::Rule::Naming::AccessorMethodName","name":"AccessorMethodName","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/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L38"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that accessor methods are named properly.\n\nFavour this:\n\n```\nclass Foo\n def user\n @user\n end\n\n def user=(value)\n @user = value\n end\nend\n```\n\nOver this:\n\n```\nclass Foo\n def get_user\n @user\n end\n\n def set_user(value)\n @user = value\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AccessorMethodName:\n Enabled: true\n```","summary":"

A rule that makes sure that accessor methods are named properly.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L38"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"defs = case body = node.body\nwhen Crystal::Def\n [body]\nwhen Crystal::Expressions\n body.expressions.select(Crystal::Def)\nend\ndefs.try(&.each do |def_node|\n if def_node.receiver\n else\n check_issue(source, def_node)\n end\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/accessor_method_name.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/accessor_method_name.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.receiver\n check_issue(source, node)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Naming/AsciiIdentifiers","path":"Ameba/Rule/Naming/AsciiIdentifiers.html","kind":"class","full_name":"Ameba::Rule::Naming::AsciiIdentifiers","name":"AsciiIdentifiers","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/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Identifier contains non-ascii characters\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-ascii characters in identifiers.\n\nFavour this:\n\n```\nclass BigAwesomeWolf\nend\n```\n\nOver this:\n\n```\nclass BigAwesome🐺\nend\n```\n\nYAML configuration example:\n\n```\nNaming/AsciiIdentifiers:\n Enabled: true\n IgnoreSymbols: false\n```","summary":"

A rule that reports non-ascii characters in identifiers.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"ignore_symbols=(ignore_symbols:Bool)-instance-method","name":"ignore_symbols=","abstract":false,"args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"args_string":"(ignore_symbols : Bool)","args_html":"(ignore_symbols : Bool)","def":{"name":"ignore_symbols=","args":[{"name":"ignore_symbols","external_name":"ignore_symbols","restriction":"Bool"}],"visibility":"Public","body":"@ignore_symbols = ignore_symbols"}},{"html_id":"ignore_symbols?:Bool-instance-method","name":"ignore_symbols?","abstract":false,"def":{"name":"ignore_symbols?","return_type":"Bool","visibility":"Public","body":"@ignore_symbols"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\n check_issue(source, target, target)\nend\ncheck_symbol_literal(source, node.value)\n"}},{"html_id":"test(source,node:Crystal::MultiAssign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"args_string":"(source, node : Crystal::MultiAssign)","args_html":"(source, node : Crystal::MultiAssign)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::MultiAssign"}],"visibility":"Public","body":"node.values.each do |value|\n check_symbol_literal(source, value)\nend"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L46"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.args.each do |arg|\n check_symbol_literal(source, arg)\nend\nnode.named_args.try(&.each do |arg|\n check_symbol_literal(source, arg.value)\nend)\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)\nnode.args.each do |arg|\n check_issue(source, arg, prefer_name_location: true)\n check_symbol_literal(source, arg.default_value)\nend\n"}},{"html_id":"test(source,node:Crystal::ClassVar|Crystal::InstanceVar|Crystal::Var|Crystal::Alias)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"args_string":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","args_html":"(source, node : Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L64"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassVar | Crystal::InstanceVar | Crystal::Var | Crystal::Alias"}],"visibility":"Public","body":"check_issue(source, node, prefer_name_location: true)"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef|Crystal::EnumDef|Crystal::LibDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef)","location":{"filename":"src/ameba/rule/naming/ascii_identifiers.cr","line_number":68,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/ascii_identifiers.cr#L68"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef | Crystal::EnumDef | Crystal::LibDef"}],"visibility":"Public","body":"check_issue(source, node.name, node.name)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BinaryOperatorParameterName","path":"Ameba/Rule/Naming/BinaryOperatorParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BinaryOperatorParameterName","name":"BinaryOperatorParameterName","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/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"When defining the `%s` operator, name its argument `other`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces that certain binary operator methods have\ntheir sole parameter named `other`.\n\nFor example, this is considered valid:\n\n```\nclass Money\n def +(other)\n end\nend\n```\n\nAnd this is invalid parameter name:\n\n```\nclass Money\n def +(amount)\n end\nend\n```\n\nYAML configuration example:\n\n```\nNaming/BinaryOperatorParameterName:\n Enabled: true\n ExcludedOperators: [\"[]\", \"[]?\", \"[]=\", \"<<\", \">>\", \"=~\", \"!~\"]\n```","summary":"

A rule that enforces that certain binary operator methods have their sole parameter named other.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"excluded_operators:Array(String)-instance-method","name":"excluded_operators","abstract":false,"def":{"name":"excluded_operators","visibility":"Public","body":"@excluded_operators"}},{"html_id":"excluded_operators=(excluded_operators:Array(String))-instance-method","name":"excluded_operators=","abstract":false,"args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"args_string":"(excluded_operators : Array(String))","args_html":"(excluded_operators : Array(String))","def":{"name":"excluded_operators=","args":[{"name":"excluded_operators","external_name":"excluded_operators","restriction":"::Array(::String)"}],"visibility":"Public","body":"@excluded_operators = excluded_operators"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/binary_operator_parameter_name.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/binary_operator_parameter_name.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name\nif (name == \"->\") || (name.in?(excluded_operators))\n return\nend\nif name.chars.any?(&.alphanumeric?)\n return\nend\nif node.args.size == 1\nelse\n return\nend\nif (arg = node.args.first).name == \"other\"\n return\nend\nissue_for(arg, MSG % name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/BlockParameterName","path":"Ameba/Rule/Naming/BlockParameterName.html","kind":"class","full_name":"Ameba::Rule::Naming::BlockParameterName","name":"BlockParameterName","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/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed block parameter name found\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that reports non-descriptive block parameter names.\n\nFavour this:\n\n```\ntokens.each { |token| token.last_accessed_at = Time.utc }\n```\n\nOver this:\n\n```\ntokens.each { |t| t.last_accessed_at = Time.utc }\n```\n\nYAML configuration example:\n\n```\nNaming/BlockParameterName:\n Enabled: true\n MinNameLength: 3\n AllowNamesEndingInNumbers: true\n AllowedNames: [_, e, i, j, k, v, x, y, ex, io, ws, op, tx, id, ip, k1, k2, v1, v2]\n ForbiddenNames: []\n```","summary":"

A rule that reports non-descriptive block parameter names.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_names_ending_in_numbers=(allow_names_ending_in_numbers:Bool)-instance-method","name":"allow_names_ending_in_numbers=","abstract":false,"args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"args_string":"(allow_names_ending_in_numbers : Bool)","args_html":"(allow_names_ending_in_numbers : Bool)","def":{"name":"allow_names_ending_in_numbers=","args":[{"name":"allow_names_ending_in_numbers","external_name":"allow_names_ending_in_numbers","restriction":"Bool"}],"visibility":"Public","body":"@allow_names_ending_in_numbers = allow_names_ending_in_numbers"}},{"html_id":"allow_names_ending_in_numbers?:Bool-instance-method","name":"allow_names_ending_in_numbers?","abstract":false,"def":{"name":"allow_names_ending_in_numbers?","return_type":"Bool","visibility":"Public","body":"@allow_names_ending_in_numbers"}},{"html_id":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"forbidden_names:Array(String)-instance-method","name":"forbidden_names","abstract":false,"def":{"name":"forbidden_names","visibility":"Public","body":"@forbidden_names"}},{"html_id":"forbidden_names=(forbidden_names:Array(String))-instance-method","name":"forbidden_names=","abstract":false,"args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"args_string":"(forbidden_names : Array(String))","args_html":"(forbidden_names : Array(String))","def":{"name":"forbidden_names=","args":[{"name":"forbidden_names","external_name":"forbidden_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@forbidden_names = forbidden_names"}},{"html_id":"min_name_length:Int32-instance-method","name":"min_name_length","abstract":false,"def":{"name":"min_name_length","return_type":"Int32","visibility":"Public","body":"@min_name_length"}},{"html_id":"min_name_length=(min_name_length:Int32)-instance-method","name":"min_name_length=","abstract":false,"args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"args_string":"(min_name_length : Int32)","args_html":"(min_name_length : Int32)","def":{"name":"min_name_length=","args":[{"name":"min_name_length","external_name":"min_name_length","restriction":"Int32"}],"visibility":"Public","body":"@min_name_length = min_name_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/naming/block_parameter_name.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/block_parameter_name.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"node.try(&.block).try(&.args).try(&.each do |arg|\n if valid_name?(arg.name)\n else\n issue_for(arg, MSG)\n end\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/ConstantNames","path":"Ameba/Rule/Naming/ConstantNames.html","kind":"class","full_name":"Ameba::Rule::Naming::ConstantNames","name":"ConstantNames","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/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Constant name should be screaming-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/ConstantNames:\n Enabled: true\n```","summary":"

A rule that enforces constant names to be in screaming case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Assign)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"args_string":"(source, node : Crystal::Assign)","args_html":"(source, node : Crystal::Assign)","location":{"filename":"src/ameba/rule/naming/constant_names.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/constant_names.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Assign"}],"visibility":"Public","body":"if (target = node.target).is_a?(Crystal::Path)\nelse\n return\nend\nname = target.to_s\nexpected = name.upcase\nif name.in?(expected, name.camelcase)\n return\nend\nissue_for(target, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/Filename","path":"Ameba/Rule/Naming/Filename.html","kind":"class","full_name":"Ameba::Rule::Naming::Filename","name":"Filename","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/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L10"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Filename should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that enforces file names to be in underscored case.\n\nYAML configuration example:\n\n```\nNaming/Filename:\n Enabled: true\n```","summary":"

A rule that enforces file names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":10,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L10"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/filename.cr","line_number":19,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/filename.cr#L19"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"path = Path[source.path]\nname = path.basename\nif (expected = name.underscore) == name\n return\nend\nissue_for(LOCATION, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/MethodNames","path":"Ameba/Rule/Naming/MethodNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L40"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Method name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/MethodNames:\n Enabled: true\n```","summary":"

A rule that enforces method names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L40"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/method_names.cr","line_number":47,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/method_names.cr#L47"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/PredicateName","path":"Ameba/Rule/Naming/PredicateName.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L26"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour method name '%s?' over '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows tautological predicate names -\nmeaning those that start with the prefix `is_`, except for\nthe ones that are not valid Crystal code (e.g. `is_404?`).\n\nFavour this:\n\n```\ndef valid?(x)\nend\n```\n\nOver this:\n\n```\ndef is_valid?(x)\nend\n```\n\nYAML configuration example:\n\n```\nNaming/PredicateName:\n Enabled: true\n```","summary":"

A rule that disallows tautological predicate names - meaning those that start with the prefix is_, except for the ones that are not valid Crystal code (e.g.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":26,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L26"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/naming/predicate_name.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/predicate_name.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if node.name =~ (/^is_([a-z]\\w*)\\??$/)\nelse\n return\nend\nalternative = $~[1]\nissue_for(node, MSG % {alternative, node.name}, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/QueryBoolMethods","path":"Ameba/Rule/Naming/QueryBoolMethods.html","kind":"class","full_name":"Ameba::Rule::Naming::QueryBoolMethods","name":"QueryBoolMethods","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/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"getter\", \"class_getter\", \"property\", \"class_property\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Consider using '%s?' for '%s'\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows boolean properties without the `?` suffix - defined\nusing `Object#(class_)property` or `Object#(class_)getter` macros.\n\nFavour this:\n\n```\nclass Person\n property? deceased = false\n getter? witty = true\nend\n```\n\nOver this:\n\n```\nclass Person\n property deceased = false\n getter witty = true\nend\n```\n\nYAML configuration example:\n\n```\nNaming/QueryBoolMethods:\n Enabled: true\n```","summary":"

A rule that disallows boolean properties without the ? suffix - defined using Object#(class_)property or Object#(class_)getter macros.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ClassDef|Crystal::ModuleDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"args_string":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","args_html":"(source, node : Crystal::ClassDef | Crystal::ModuleDef)","location":{"filename":"src/ameba/rule/naming/query_bool_methods.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/query_bool_methods.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ClassDef | Crystal::ModuleDef"}],"visibility":"Public","body":"calls = case body = node.body\nwhen Crystal::Call\n if body.name.in?(CALL_NAMES)\n [body]\n end\nwhen Crystal::Expressions\n (body.expressions.select(Crystal::Call)).select!() do |__arg0|\n __arg0.name.in?(CALL_NAMES)\n end\nend\ncalls.try(&.each do |exp|\n exp.args.each do |arg|\n name_node, is_bool = case arg\n when Crystal::Assign\n {arg.target, arg.value.is_a?(Crystal::BoolLiteral)}\n when Crystal::TypeDeclaration\n {arg.var, path_named?(arg.declared_type, \"Bool\")}\n else\n {nil, false}\n end\n if name_node && is_bool\n issue_for(name_node, MSG % {exp.name, name_node})\n end\n end\nend)\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/RescuedExceptionsVariableName","path":"Ameba/Rule/Naming/RescuedExceptionsVariableName.html","kind":"class","full_name":"Ameba::Rule::Naming::RescuedExceptionsVariableName","name":"RescuedExceptionsVariableName","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/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Disallowed variable name, use one of these instead: '%s'\""},{"id":"MSG_SINGULAR","name":"MSG_SINGULAR","value":"\"Disallowed variable name, use '%s' instead\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that makes sure that rescued exceptions variables are named as expected.\n\nFor example, these are considered valid:\n\n def foo\n # potentially raising computations\n rescue e\n Log.error(exception: e) { \"Error\" }\n end\n\nAnd these are invalid variable names:\n\n def foo\n # potentially raising computations\n rescue wtf\n Log.error(exception: wtf) { \"Error\" }\n end\n\nYAML configuration example:\n\n```\nNaming/RescuedExceptionsVariableName:\n Enabled: true\n AllowedNames: [e, ex, exception, error]\n```","summary":"

A rule that makes sure that rescued exceptions variables are named as expected.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L27"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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":"allowed_names:Array(String)-instance-method","name":"allowed_names","abstract":false,"def":{"name":"allowed_names","visibility":"Public","body":"@allowed_names"}},{"html_id":"allowed_names=(allowed_names:Array(String))-instance-method","name":"allowed_names=","abstract":false,"args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"args_string":"(allowed_names : Array(String))","args_html":"(allowed_names : Array(String))","def":{"name":"allowed_names=","args":[{"name":"allowed_names","external_name":"allowed_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@allowed_names = allowed_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::ExceptionHandler)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"args_string":"(source, node : Crystal::ExceptionHandler)","args_html":"(source, node : Crystal::ExceptionHandler)","location":{"filename":"src/ameba/rule/naming/rescued_exceptions_variable_name.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/rescued_exceptions_variable_name.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::ExceptionHandler"}],"visibility":"Public","body":"node.rescues.try(&.each do |rescue_node|\n if valid_name?(rescue_node.name)\n next\n end\n message = allowed_names.size == 1 ? MSG_SINGULAR : MSG\n issue_for(rescue_node, message % (allowed_names.join(\"', '\")))\nend)"}}]},{"html_id":"ameba/Ameba/Rule/Naming/TypeNames","path":"Ameba/Rule/Naming/TypeNames.html","kind":"class","full_name":"Ameba::Rule::Naming::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/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Type name should be camelcased: %s, but it was %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/TypeNames:\n Enabled: true\n```","summary":"

A rule that enforces type names in camelcase manner.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Alias|Crystal::ClassDef|Crystal::ModuleDef|Crystal::LibDef|Crystal::EnumDef)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"args_string":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","args_html":"(source, node : Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef)","location":{"filename":"src/ameba/rule/naming/type_names.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/type_names.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Alias | Crystal::ClassDef | Crystal::ModuleDef | Crystal::LibDef | Crystal::EnumDef"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.camelcase) == name\n return\nend\nissue_for(node.name, MSG % {expected, name})\n"}}]},{"html_id":"ameba/Ameba/Rule/Naming/VariableNames","path":"Ameba/Rule/Naming/VariableNames.html","kind":"class","full_name":"Ameba::Rule::Naming::VariableNames","name":"VariableNames","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/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Var name should be underscore-cased: %s, not %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Naming","kind":"module","full_name":"Ameba::Rule::Naming","name":"Naming"},"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\nNaming/VariableNames:\n Enabled: true\n```","summary":"

A rule that enforces variable names to be in underscored case.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Var|Crystal::InstanceVar|Crystal::ClassVar)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"args_string":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","args_html":"(source, node : Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Var | Crystal::InstanceVar | Crystal::ClassVar"}],"visibility":"Public","body":"name = node.name.to_s\nif (expected = name.underscore) == name\n return\nend\nissue_for(node, MSG % {expected, name})\n"}},{"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\nBy default it uses a node visitor to traverse all the nodes in the source.\n\nNOTE: Must be overridden for other type of rules.","summary":"

This method is designed to test the source passed in.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/naming/variable_names.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/naming/variable_names.cr#L32"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"VarVisitor.new(self, source)"}}]}]},{"html_id":"ameba/Ameba/Rule/Performance","path":"Ameba/Rule/Performance.html","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance","abstract":false,"locations":[{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L3"},{"filename":"src/ameba/rule/performance/base.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/base.cr#L3"},{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L3"},{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L3"},{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L3"},{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L3"},{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L3"},{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L3"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","path":"Ameba/Rule/Performance/AnyAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `any? {...}` instead of `%s {...}.any?`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `any?` calls that follow filters.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.any?\n[1, 2, 3].reject { |e| e >= 2 }.any?\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].any? { |e| e > 2 }\n[1, 2, 3].any? { |e| e < 2 }\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

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

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_after_filter.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_after_filter.cr#L39"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"any?\") && (obj = node.obj)\nelse\n return\nend\nif (obj.is_a?(Crystal::Call) && obj.block) && node.block.nil?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","path":"Ameba/Rule/Performance/AnyInsteadOfEmpty.html","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty","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/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `!{...}.empty?` instead of `{...}.any?`\""}],"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"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 arg-less `Enumerable#any?` calls.\n\nUsing `Enumerable#any?` instead of `Enumerable#empty?` might lead to an\nunexpected results (like `[nil, false].any? # => false`). In some cases\nit also might be less efficient, since it iterates until the block will\nreturn a _truthy_ value, instead of just checking if there's at least\none value present.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].any?\n```\n\nAnd it should be written as this:\n\n```\n![1, 2, 3].empty?\n```\n\nYAML configuration example:\n\n```\nPerformance/AnyInsteadOfEmpty:\n Enabled: true\n```","summary":"

This rule is used to identify usage of arg-less Enumerable#any? calls.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/any_instead_of_empty.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/any_instead_of_empty.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name == \"any?\"\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif node.obj\nelse\n return\nend\nissue_for(node, MSG, prefer_name_location: true)\n"}}]},{"html_id":"ameba/Ameba/Rule/Performance/Base","path":"Ameba/Rule/Performance/Base.html","kind":"class","full_name":"Ameba::Rule::Performance::Base","name":"Base","abstract":true,"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/performance/base.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/base.cr#L5"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"}],"subclasses":[{"html_id":"ameba/Ameba/Rule/Performance/AnyAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::AnyAfterFilter","name":"AnyAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/AnyInsteadOfEmpty","kind":"class","full_name":"Ameba::Rule::Performance::AnyInsteadOfEmpty","name":"AnyInsteadOfEmpty"},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang"},{"html_id":"ameba/Ameba/Rule/Performance/CompactAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::CompactAfterMap","name":"CompactAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations"},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter"},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock"},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap"},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"A general base class for performance rules.","summary":"

A general base class for performance rules.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/performance/base.cr#L5"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":"Source"}],"args_string":"(source : Source)","args_html":"(source : Source)","location":{"filename":"src/ameba/rule/performance/base.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/base.cr#L6"},"def":{"name":"catch","args":[{"name":"source","external_name":"source","restriction":"Source"}],"visibility":"Public","body":"source.spec? ? source : super(source)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ChainedCallWithNoBang","path":"Ameba/Rule/Performance/ChainedCallWithNoBang.html","kind":"class","full_name":"Ameba::Rule::Performance::ChainedCallWithNoBang","name":"ChainedCallWithNoBang","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/chained_call_with_no_bang.cr","line_number":39,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ALLOCATING_METHOD_NAMES","name":"ALLOCATING_METHOD_NAMES","value":"[\"keys\", \"values\", \"values_at\", \"map\", \"map_with_index\", \"flat_map\", \"compact_map\", \"flatten\", \"compact\", \"select\", \"reject\", \"sample\", \"group_by\", \"chunks\", \"tally\", \"merge\", \"combinations\", \"repeated_combinations\", \"permutations\", \"repeated_permutations\", \"transpose\", \"invert\", \"chars\", \"captures\", \"named_captures\", \"clone\"] of ::String","doc":"All these methods allocate a new object","summary":"

All these methods allocate a new object

"},{"id":"MSG","name":"MSG","value":"\"Use bang method variant `%s!` after chained `%s` call\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"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","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Array(String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"args_string":"(call_names : Array(String))","args_html":"(call_names : Array(String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"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\nif end_location = name_end_location(node)\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true) do |corrector|\n corrector.insert_after(end_location, '!')\n end\nelse\n issue_for(node, MSG % {node.name, obj.name}, prefer_name_location: true)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/chained_call_with_no_bang.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/chained_call_with_no_bang.cr#L61"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"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/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/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/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `compact_map {...}` instead of `map {...}.compact`\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","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.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"compact\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/compact_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/compact_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/ExcessiveAllocations","path":"Ameba/Rule/Performance/ExcessiveAllocations.html","kind":"class","full_name":"Ameba::Rule::Performance::ExcessiveAllocations","name":"ExcessiveAllocations","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L32"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `%s.each {...}` to avoid excessive allocation\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 excessive collection allocations,\nthat can be avoided by using `each_` instead of `.each`.\n\nFor example, this is considered inefficient:\n\n```\n\"Alice\".chars.each { |c| puts c }\n\"Alice\\nBob\".lines.each { |l| puts l }\n```\n\nAnd can be written as this:\n\n```\n\"Alice\".each_char { |c| puts c }\n\"Alice\\nBob\".each_line { |l| puts l }\n```\n\nYAML configuration example:\n\n```\nPerformance/ExcessiveAllocations:\n Enabled: true\n CallNames:\n codepoints: each_codepoint\n graphemes: each_grapheme\n chars: each_char\n lines: each_line\n```","summary":"

This rule is used to identify excessive collection allocations, that can be avoided by using each_<member> instead of <collection>.each.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":32,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L32"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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:Hash(String,String)-instance-method","name":"call_names","abstract":false,"def":{"name":"call_names","visibility":"Public","body":"@call_names"}},{"html_id":"call_names=(call_names:Hash(String,String))-instance-method","name":"call_names=","abstract":false,"args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"args_string":"(call_names : Hash(String, String))","args_html":"(call_names : Hash(String, String))","def":{"name":"call_names=","args":[{"name":"call_names","external_name":"call_names","restriction":"::Hash(::String, ::String)"}],"visibility":"Public","body":"@call_names = call_names"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"each\") && node.args.empty?\nelse\n return\nend\nif (obj = node.obj).is_a?(Crystal::Call)\nelse\n return\nend\nif obj.args.empty? && obj.block.nil?\nelse\n return\nend\nif method = call_names[obj.name]?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nmsg = MSG % {method, obj.name}\nissue_for(name_location, end_location, msg) do |corrector|\n corrector.replace(name_location, end_location, method)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/excessive_allocations.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/excessive_allocations.cr#L50"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FirstLastAfterFilter","path":"Ameba/Rule/Performance/FirstLastAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::FirstLastAfterFilter","name":"FirstLastAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"first\", \"last\", \"first?\", \"last?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `find {...}` instead of `%s {...}.%s`\""},{"id":"MSG_REVERSE","name":"MSG_REVERSE","value":"\"Use `reverse_each.find {...}` instead of `%s {...}.%s`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `first/last/first?/last?` calls that follow filters.\n\nFor example, this is considered inefficient:\n\n```\n[-1, 0, 1, 2].select { |e| e > 0 }.first?\n[-1, 0, 1, 2].select { |e| e > 0 }.last?\n```\n\nAnd can be written as this:\n\n```\n[-1, 0, 1, 2].find { |e| e > 0 }\n[-1, 0, 1, 2].reverse_each.find { |e| e > 0 }\n```\n\nYAML configuration example:\n\n```\nPerformance/FirstLastAfterFilter\n Enabled: true\n FilterNames:\n - select\n```","summary":"

This rule is used to identify usage of first/last/first?/last? calls that follow filters.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif node.block.nil? && node.args.empty?\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nmessage = node.name.includes?(CALL_NAMES.first) ? MSG : MSG_REVERSE\nissue_for(name_location(obj), name_end_location(node), message % {obj.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/first_last_after_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/first_last_after_filter.cr#L41"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/FlattenAfterMap","path":"Ameba/Rule/Performance/FlattenAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::FlattenAfterMap","name":"FlattenAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L24"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `flat_map {...}` instead of `map {...}.flatten`\""}],"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"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `flatten` calls that follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n%w[Alice Bob].map(&.chars).flatten\n```\n\nAnd can be written as this:\n\n```\n%w[Alice Bob].flat_map(&.chars)\n```\n\nYAML configuration example:\n\n```\nPerformance/FlattenAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of flatten calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":24,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L24"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":37,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L37"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"flatten\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/flatten_after_map.cr","line_number":33,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/flatten_after_map.cr#L33"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MapInsteadOfBlock","path":"Ameba/Rule/Performance/MapInsteadOfBlock.html","kind":"class","full_name":"Ameba::Rule::Performance::MapInsteadOfBlock","name":"MapInsteadOfBlock","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L25"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"sum\", \"product\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`\""}],"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"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `sum/product` calls\nthat follow `map`.\n\nFor example, this is considered inefficient:\n\n```\n(1..3).map(&.*(2)).sum\n```\n\nAnd can be written as this:\n\n```\n(1..3).sum(&.*(2))\n```\n\nYAML configuration example:\n\n```\nPerformance/MapInsteadOfBlock:\n Enabled: true\n```","summary":"

This rule is used to identify usage of sum/product calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":25,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L25"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":40,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L40"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name.in?(CALL_NAMES)) && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name == \"map\"\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % {node.name, node.name})\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/map_instead_of_block.cr","line_number":36,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/map_instead_of_block.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/MinMaxAfterMap","path":"Ameba/Rule/Performance/MinMaxAfterMap.html","kind":"class","full_name":"Ameba::Rule::Performance::MinMaxAfterMap","name":"MinMaxAfterMap","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_NAMES","name":"CALL_NAMES","value":"[\"min\", \"min?\", \"max\", \"max?\", \"minmax\", \"minmax?\"] of ::String"},{"id":"MSG","name":"MSG","value":"\"Use `%s {...}` instead of `map {...}.%s`.\""}],"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"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `min/max/minmax` calls that follow `map`.\n\nFor example, this is considered invalid:\n\n```\n%w[Alice Bob].map(&.size).min\n%w[Alice Bob].map(&.size).max\n%w[Alice Bob].map(&.size).minmax\n```\n\nAnd it should be written as this:\n\n```\n%w[Alice Bob].min_of(&.size)\n%w[Alice Bob].max_of(&.size)\n%w[Alice Bob].minmax_of(&.size)\n```\n\nYAML configuration example:\n\n```\nPerformance/MinMaxAfterMap:\n Enabled: true\n```","summary":"

This rule is used to identify usage of min/max/minmax calls that follow map.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":42,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L42"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if ((node.name.in?(CALL_NAMES)) && node.block.nil?) && node.args.empty?\nelse\n return\nend\nif (obj = node.obj) && obj.is_a?(Crystal::Call)\nelse\n return\nend\nif ((obj.name == \"map\") && obj.block) && obj.args.empty?\nelse\n return\nend\nif name_location = name_location(obj)\nelse\n return\nend\nif end_location = name_end_location(node)\nelse\n return\nend\nof_name = node.name.sub(/(.+?)(\\?)?$/, \"\\\\1_of\\\\2\")\nmessage = MSG % {of_name, node.name}\nissue_for(name_location, end_location, message) do |corrector|\n if node_name_location = name_location(node)\n else\n next\n end\n corrector.replace(name_location, name_location.adjust(column_number: {{ \"map\".size - 1 }}), of_name)\n corrector.remove(node_name_location.adjust(column_number: -1), end_location)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/minmax_after_map.cr","line_number":38,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/minmax_after_map.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Performance/SizeAfterFilter","path":"Ameba/Rule/Performance/SizeAfterFilter.html","kind":"class","full_name":"Ameba::Rule::Performance::SizeAfterFilter","name":"SizeAfterFilter","abstract":false,"superclass":{"html_id":"ameba/Ameba/Rule/Performance/Base","kind":"class","full_name":"Ameba::Rule::Performance::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/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/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L35"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `count {...}` instead of `%s {...}.size`.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Performance","kind":"module","full_name":"Ameba::Rule::Performance","name":"Performance"},"doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","doc":"This rule is used to identify usage of `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `size` calls that follow filter.\n\nFor example, this is considered invalid:\n\n```\n[1, 2, 3].select { |e| e > 2 }.size\n[1, 2, 3].reject { |e| e < 2 }.size\n[1, 2, 3].select(&.< 2).size\n[0, 1, 2].select(&.zero?).size\n[0, 1, 2].reject(&.zero?).size\n```\n\nAnd it should be written as this:\n\n```\n[1, 2, 3].count { |e| e > 2 }\n[1, 2, 3].count { |e| e >= 2 }\n[1, 2, 3].count(&.< 2)\n[0, 1, 2].count(&.zero?)\n[0, 1, 2].count(&.!= 0)\n```\n\nYAML configuration example:\n\n```\nPerformance/SizeAfterFilter:\n Enabled: true\n FilterNames:\n - select\n - reject\n```","summary":"

This rule is used to identify usage of size calls that follow filter.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L35"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":49,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L49"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (node.name == \"size\") && (obj = node.obj)\nelse\n return\nend\nif obj.is_a?(Crystal::Call) && obj.block\nelse\n return\nend\nif obj.name.in?(filter_names)\nelse\n return\nend\nissue_for(name_location(obj), name_end_location(node), MSG % obj.name)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/performance/size_after_filter.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/performance/size_after_filter.cr#L45"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]}]},{"html_id":"ameba/Ameba/Rule/Style","path":"Ameba/Rule/Style.html","kind":"module","full_name":"Ameba::Rule::Style","name":"Style","abstract":false,"locations":[{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L1"},{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L1"},{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L1"},{"filename":"src/ameba/rule/style/large_numbers.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/large_numbers.cr#L1"},{"filename":"src/ameba/rule/style/negated_conditions_in_unless.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L1"},{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L1"},{"filename":"src/ameba/rule/style/redundant_begin.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_begin.cr#L1"},{"filename":"src/ameba/rule/style/redundant_next.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L1"},{"filename":"src/ameba/rule/style/redundant_return.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L1"},{"filename":"src/ameba/rule/style/unless_else.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/unless_else.cr#L1"},{"filename":"src/ameba/rule/style/verbose_block.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/verbose_block.cr#L1"},{"filename":"src/ameba/rule/style/while_true.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/while_true.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Rule","kind":"module","full_name":"Ameba::Rule","name":"Rule"},"types":[{"html_id":"ameba/Ameba/Rule/Style/GuardClause","path":"Ameba/Rule/Style/GuardClause.html","kind":"class","full_name":"Ameba::Rule::Style::GuardClause","name":"GuardClause","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/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L54"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use a guard clause (`%s`) instead of wrapping the code inside a conditional expression.\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"Use a guard clause instead of wrapping the code inside a conditional\nexpression\n\n```\n# bad\ndef test\n if something\n work\n end\nend\n\n# good\ndef test\n return unless something\n\n work\nend\n\n# also good\ndef test\n work if something\nend\n\n# bad\nif something\n raise \"exception\"\nelse\n ok\nend\n\n# good\nraise \"exception\" if something\nok\n\n# bad\nif something\n foo || raise(\"exception\")\nelse\n ok\nend\n\n# good\nfoo || raise(\"exception\") if something\nok\n```\n\nYAML configuration example:\n\n```\nStyle/GuardClause:\n Enabled: true\n```","summary":"

Use a guard clause instead of wrapping the code inside a conditional expression

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L54"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"guard_clause_source(source,guard_clause,parent)-instance-method","name":"guard_clause_source","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"args_string":"(source, guard_clause, parent)","args_html":"(source, guard_clause, parent)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":180,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L180"},"def":{"name":"guard_clause_source","args":[{"name":"source","external_name":"source","restriction":""},{"name":"guard_clause","external_name":"guard_clause","restriction":""},{"name":"parent","external_name":"parent","restriction":""}],"visibility":"Public","body":"node = parent.is_a?(Crystal::BinaryOp) ? parent : guard_clause\nnode_source(node, source.lines)\n"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"args_string":"(source, node : Crystal::Def)","args_html":"(source, node : Crystal::Def)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L71"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"final_expression = if (body = node.body).is_a?(Crystal::Expressions)\n body.last\nelse\n body\nend\ncase final_expression\nwhen Crystal::If, Crystal::Unless\n check_ending_if(source, final_expression)\nend\n"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"args_string":"(source, node : Crystal::If | Crystal::Unless)","args_html":"(source, node : Crystal::If | Crystal::Unless)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":85,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L85"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless"}],"visibility":"Public","body":"if accepted_form?(source, node, ending: false)\n return\nend\ncase\nwhen guard_clause = guard_clause(node.then)\n parent, conditional_keyword = node.then, keyword(node)\nwhen guard_clause = guard_clause(node.else)\n parent, conditional_keyword = node.else, opposite_keyword(node)\nend\nif (guard_clause && parent) && conditional_keyword\nelse\n return\nend\nguard_clause_source = guard_clause_source(source, guard_clause, parent)\nreport_issue(source, node, guard_clause_source, conditional_keyword)\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/guard_clause.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/guard_clause.cr#L65"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: [Crystal::Assign])"}}]},{"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/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/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L41"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `%s` instead of `%s`\""},{"id":"NEW","name":"NEW","value":"\"%s(%s)\""},{"id":"OLD","name":"OLD","value":"\"%s {...}\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `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.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L41"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"filter_names:Array(String)-instance-method","name":"filter_names","abstract":false,"def":{"name":"filter_names","visibility":"Public","body":"@filter_names"}},{"html_id":"filter_names=(filter_names:Array(String))-instance-method","name":"filter_names=","abstract":false,"args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"args_string":"(filter_names : Array(String))","args_html":"(filter_names : Array(String))","def":{"name":"filter_names=","args":[{"name":"filter_names","external_name":"filter_names","restriction":"::Array(::String)"}],"visibility":"Public","body":"@filter_names = filter_names"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"args_string":"(source, node : Crystal::Call)","args_html":"(source, node : Crystal::Call)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L58"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if node.name.in?(filter_names)\nelse\n return\nend\nif filter_location = name_location(node)\nelse\n return\nend\nif block = node.block\nelse\n return\nend\nif (body = block.body).is_a?(Crystal::IsA)\nelse\n return\nend\nif (path = body.const).is_a?(Crystal::Path)\nelse\n return\nend\nif body.obj.is_a?(Crystal::Var)\nelse\n return\nend\nif block.args.size > 1\n return\nend\nname = path.names.join(\"::\")\nif path.global? && (!body.nil_check?)\n name = \"::#{name}\"\nend\nend_location = node.end_location\nif (!end_location) || end_location.try() do |__arg0|\n __arg0.column_number.zero?\nend\n if end_location = path.end_location\n end_location = end_location.adjust(column_number: 1)\n end\nend\nold = OLD % node.name\nnew = NEW % {node.name, name}\nmsg = MSG % {new, old}\nif end_location\n issue_for(filter_location, end_location, msg) do |corrector|\n corrector.replace(filter_location, end_location, new)\n end\nelse\n issue_for(filter_location, nil, msg)\nend\n"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/rule/style/is_a_filter.cr","line_number":54,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_filter.cr#L54"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"AST::NodeVisitor.new(self, source, skip: :macro)"}}]},{"html_id":"ameba/Ameba/Rule/Style/IsANil","path":"Ameba/Rule/Style/IsANil.html","kind":"class","full_name":"Ameba::Rule::Style::IsANil","name":"IsANil","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/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L22"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Use `nil?` instead of `is_a?(Nil)`\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows calls to `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 `is_a?(Nil)` in favor of `nil?`.\n\nThis is considered bad:\n\n```\nvar.is_a?(Nil)\n```\n\nAnd needs to be written as:\n\n```\nvar.nil?\n```\n\nYAML configuration example:\n\n```\nStyle/IsANil:\n Enabled: true\n```","summary":"

A rule that disallows calls to is_a?(Nil) in favor of nil?.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L22"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::IsA)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"args_string":"(source, node : Crystal::IsA)","args_html":"(source, node : Crystal::IsA)","location":{"filename":"src/ameba/rule/style/is_a_nil.cr","line_number":31,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/is_a_nil.cr#L31"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::IsA"}],"visibility":"Public","body":"if node.nil_check?\n return\nend\nconst = node.const\nif path_named?(const, \"Nil\")\nelse\n return\nend\nissue_for(const, MSG) do |corrector|\n corrector.replace(node, \"#{node.obj}.nil?\")\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/LargeNumbers","path":"Ameba/Rule/Style/LargeNumbers.html","kind":"class","full_name":"Ameba::Rule::Style::LargeNumbers","name":"LargeNumbers","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/large_numbers.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/large_numbers.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Large numbers should be written with underscores: %s\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows usage of large numbers without underscore.\nThese do not affect the value of the number, but can help read\nlarge numbers more easily.\n\nFor example, these are considered invalid:\n\n```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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```\n100000\n141592654\n5.123456\n```\n\nAnd has to be rewritten as the following:\n\n```\n100_000\n141_592_654\n5.123_456\n```\n\nYAML configuration example:\n\n```\nStyle/LargeNumbers:\n Enabled: true\n IntMinDigits: 6 # i.e. integers higher than 99999\n```","summary":"

A rule that disallows usage of large numbers without underscore.

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/style/large_numbers.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","return_type":"Bool","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"int_min_digits:Int32-instance-method","name":"int_min_digits","abstract":false,"def":{"name":"int_min_digits","return_type":"Int32","visibility":"Public","body":"@int_min_digits"}},{"html_id":"int_min_digits=(int_min_digits:Int32)-instance-method","name":"int_min_digits=","abstract":false,"args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"args_string":"(int_min_digits : Int32)","args_html":"(int_min_digits : Int32)","def":{"name":"int_min_digits=","args":[{"name":"int_min_digits","external_name":"int_min_digits","restriction":"Int32"}],"visibility":"Public","body":"@int_min_digits = int_min_digits"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source)-instance-method","name":"test","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/rule/style/large_numbers.cr#L38"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""}],"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 location = token.location\n end_location = location.adjust(column_number: token.raw.size - 1)\n issue_for(location, end_location, MSG % expected) do |corrector|\n corrector.replace(location, end_location, expected)\n end\n end\nend"}}]},{"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/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Avoid negated conditions in unless blocks\""}],"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"}],"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.empty?\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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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.empty?\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","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/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/style/negated_conditions_in_unless.cr#L36"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if negated_condition?(node.cond)\n issue_for(node, MSG)\nend"}}]},{"html_id":"ameba/Ameba/Rule/Style/ParenthesesAroundCondition","path":"Ameba/Rule/Style/ParenthesesAroundCondition.html","kind":"class","full_name":"Ameba::Rule::Style::ParenthesesAroundCondition","name":"ParenthesesAroundCondition","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/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L29"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG_MISSING","name":"MSG_MISSING","value":"\"Missing parentheses\""},{"id":"MSG_REDUNDANT","name":"MSG_REDUNDANT","value":"\"Redundant parentheses\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that checks for the presence of superfluous parentheses\naround the condition of `if`, `unless`, `case`, `while` and `until`.\n\nFor example, this is considered invalid:\n\n```\nif (foo == 42)\n do_something\nend\n```\n\nAnd should be replaced by the following:\n\n```\nif foo == 42\n do_something\nend\n```\n\nYAML configuration example:\n\n```\nStyle/ParenthesesAroundCondition:\n Enabled: true\n ExcludeTernary: false\n AllowSafeAssignment: false\n```","summary":"

A rule that checks for the presence of superfluous parentheses around the condition of if, unless, case, while and until.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L29"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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_safe_assignment=(allow_safe_assignment:Bool)-instance-method","name":"allow_safe_assignment=","abstract":false,"args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"args_string":"(allow_safe_assignment : Bool)","args_html":"(allow_safe_assignment : Bool)","def":{"name":"allow_safe_assignment=","args":[{"name":"allow_safe_assignment","external_name":"allow_safe_assignment","restriction":"Bool"}],"visibility":"Public","body":"@allow_safe_assignment = allow_safe_assignment"}},{"html_id":"allow_safe_assignment?:Bool-instance-method","name":"allow_safe_assignment?","abstract":false,"def":{"name":"allow_safe_assignment?","return_type":"Bool","visibility":"Public","body":"@allow_safe_assignment"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_ternary=(exclude_ternary:Bool)-instance-method","name":"exclude_ternary=","abstract":false,"args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"args_string":"(exclude_ternary : Bool)","args_html":"(exclude_ternary : Bool)","def":{"name":"exclude_ternary=","args":[{"name":"exclude_ternary","external_name":"exclude_ternary","restriction":"Bool"}],"visibility":"Public","body":"@exclude_ternary = exclude_ternary"}},{"html_id":"exclude_ternary?:Bool-instance-method","name":"exclude_ternary?","abstract":false,"def":{"name":"exclude_ternary?","return_type":"Bool","visibility":"Public","body":"@exclude_ternary"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::If|Crystal::Unless|Crystal::Case|Crystal::While|Crystal::Until)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"args_string":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","args_html":"(source, node : Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until)","location":{"filename":"src/ameba/rule/style/parentheses_around_condition.cr","line_number":55,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/parentheses_around_condition.cr#L55"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::If | Crystal::Unless | Crystal::Case | Crystal::While | Crystal::Until"}],"visibility":"Public","body":"cond = node.cond\nif cond.is_a?(Crystal::Assign) && allow_safe_assignment?\n issue_for(cond, MSG_MISSING) do |corrector|\n corrector.wrap(cond, '(', ')')\n end\n return\nend\nis_ternary = node.is_a?(Crystal::If) && node.ternary?\nif is_ternary && exclude_ternary?\n return\nend\nif cond.is_a?(Crystal::Expressions)\nelse\n return\nend\nif cond.keyword.paren?\nelse\n return\nend\nif exp = cond.single_expression?\nelse\n return\nend\nif strip_parentheses?(exp, is_ternary)\nelse\n return\nend\nissue_for(cond, MSG_REDUNDANT) do |corrector|\n corrector.remove_trailing(cond, 1)\n corrector.remove_leading(cond, 1)\nend\n"}}]},{"html_id":"ameba/Ameba/Rule/Style/RedundantBegin","path":"Ameba/Rule/Style/RedundantBegin.html","kind":"class","full_name":"Ameba::Rule::Style::RedundantBegin","name":"RedundantBegin","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/style/redundant_begin.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_begin.cr#L58"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `begin` block detected\""}],"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"}],"namespace":{"html_id":"ameba/Ameba/Rule/Style","kind":"module","full_name":"Ameba::Rule::Style","name":"Style"},"doc":"A rule that disallows redundant begin blocks.\n\nCurrently it is able to detect:\n\n1. Exception handler block that can be used as a part of the method.\n\nFor example, this:\n\n```\ndef method\n begin\n read_content\n rescue\n close_file\n end\nend\n```\n\nshould be rewritten as:\n\n```\ndef method\n read_content\nrescue\n close_file\nend\n```\n\n2. begin..end block as a top level block in a method.\n\nFor example this is considered invalid:\n\n```\ndef method\n begin\n a = 1\n b = 2\n end\nend\n```\n\nand has to be written as the following:\n\n```\ndef method\n a = 1\n b = 2\nend\n```\n\nYAML configuration example:\n\n```\nStyle/RedundantBegin:\n Enabled: true\n```","summary":"

A rule that disallows redundant begin blocks.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/style/redundant_begin.cr#L58"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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/6d03cef/src/ameba/rule/style/redundant_begin.cr#L67"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"if def_loc = node.location\nelse\n return\nend\ncase body = node.body\nwhen Crystal::ExceptionHandler\n if (begin_exprs_in_handler?(body)) || (inner_handler?(body))\n return\n end\nwhen Crystal::Expressions\n if redundant_begin_in_expressions?(body)\n else\n return\n end\nelse\n return\nend\nif begin_range = def_redundant_begin_range(source, node)\nelse\n return\nend\nbegin_loc, end_loc = begin_range\nbegin_loc, end_loc = def_loc.seek(begin_loc), def_loc.seek(end_loc)\nbegin_end_loc = begin_loc.adjust(column_number: {{ \"begin\".size - 1 }})\nend_end_loc = end_loc.adjust(column_number: {{ \"end\".size - 1 }})\nissue_for(begin_loc, begin_end_loc, MSG) do |corrector|\n corrector.remove(begin_loc, begin_end_loc)\n corrector.remove(end_loc, end_end_loc)\nend\n"}}]},{"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/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/style/redundant_next.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L99"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `next` detected\""}],"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"}],"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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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","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/6d03cef/src/ameba/rule/style/redundant_next.cr#L99"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_next:Bool)-instance-method","name":"allow_empty_next=","abstract":false,"args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"args_string":"(allow_empty_next : Bool)","args_html":"(allow_empty_next : Bool)","def":{"name":"allow_empty_next=","args":[{"name":"allow_empty_next","external_name":"allow_empty_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_next = allow_empty_next"}},{"html_id":"allow_empty_next?:Bool-instance-method","name":"allow_empty_next?","abstract":false,"def":{"name":"allow_empty_next?","return_type":"Bool","visibility":"Public","body":"@allow_empty_next"}},{"html_id":"allow_multi_next=(allow_multi_next:Bool)-instance-method","name":"allow_multi_next=","abstract":false,"args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"args_string":"(allow_multi_next : Bool)","args_html":"(allow_multi_next : Bool)","def":{"name":"allow_multi_next=","args":[{"name":"allow_multi_next","external_name":"allow_multi_next","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_next = allow_multi_next"}},{"html_id":"allow_multi_next?:Bool-instance-method","name":"allow_multi_next?","abstract":false,"def":{"name":"allow_multi_next?","return_type":"Bool","visibility":"Public","body":"@allow_multi_next"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","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":115,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L115"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Next"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Block)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":111,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_next.cr#L111"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Block"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/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/style/redundant_return.cr","line_number":96,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Redundant `return` detected\""}],"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"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 AllowMultiReturn: true\n AllowEmptyReturn: true\n```","summary":"

A rule that disallows redundant return expressions.

","abstract":false,"args":[{"name":"config","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/6d03cef/src/ameba/rule/style/redundant_return.cr#L96"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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=(allow_empty_return:Bool)-instance-method","name":"allow_empty_return=","abstract":false,"args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"args_string":"(allow_empty_return : Bool)","args_html":"(allow_empty_return : Bool)","def":{"name":"allow_empty_return=","args":[{"name":"allow_empty_return","external_name":"allow_empty_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_empty_return = allow_empty_return"}},{"html_id":"allow_empty_return?:Bool-instance-method","name":"allow_empty_return?","abstract":false,"def":{"name":"allow_empty_return?","return_type":"Bool","visibility":"Public","body":"@allow_empty_return"}},{"html_id":"allow_multi_return=(allow_multi_return:Bool)-instance-method","name":"allow_multi_return=","abstract":false,"args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"args_string":"(allow_multi_return : Bool)","args_html":"(allow_multi_return : Bool)","def":{"name":"allow_multi_return=","args":[{"name":"allow_multi_return","external_name":"allow_multi_return","restriction":"Bool"}],"visibility":"Public","body":"@allow_multi_return = allow_multi_return"}},{"html_id":"allow_multi_return?:Bool-instance-method","name":"allow_multi_return?","abstract":false,"def":{"name":"allow_multi_return?","return_type":"Bool","visibility":"Public","body":"@allow_multi_return"}},{"html_id":"description:String-instance-method","name":"description","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","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":112,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L112"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Return"},{"name":"visitor","external_name":"visitor","restriction":"AST::RedundantControlExpressionVisitor"}],"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.try(&.nop?))\n return\nend\nif exp_code = control_exp_code(node, source.lines)\n issue_for(node, MSG) do |corrector|\n corrector.replace(node, exp_code)\n end\nelse\n issue_for(node, MSG)\nend\n"}},{"html_id":"test(source,node:Crystal::Def)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":108,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/redundant_return.cr#L108"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Def"}],"visibility":"Public","body":"AST::RedundantControlExpressionVisitor.new(self, source, node.body)"}}]},{"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/6d03cef/src/ameba/rule/style/unless_else.cr#L45"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"Favour if over unless with else\""}],"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"}],"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.

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of an `else` block with the `unless`.\n\nFor example, the rule considers these valid:\n\n```\nunless something\n :ok\nend\n\nif something\n :one\nelse\n :two\nend\n```\n\nBut it considers this one invalid as it is an `unless` with an `else`:\n\n```\nunless something\n :one\nelse\n :two\nend\n```\n\nThe solution is to swap the order of the blocks, and change the `unless` to\nan `if`, so the previous invalid example would become this:\n\n```\nif something\n :two\nelse\n :one\nend\n```\n\nYAML configuration example:\n\n```\nStyle/UnlessElse:\n Enabled: true\n```","summary":"

A rule that disallows the use of an else block with the unless.

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":45,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/unless_else.cr#L45"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Unless)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"args_string":"(source, node : Crystal::Unless)","args_html":"(source, node : Crystal::Unless)","location":{"filename":"src/ameba/rule/style/unless_else.cr","line_number":52,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/unless_else.cr#L52"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Unless"}],"visibility":"Public","body":"if node.else.nop?\n return\nend\nlocation = node.location\ncond_end_location = node.cond.end_location\nelse_location = node.else_location\nend_location = node.end_location\nif ((location && cond_end_location) && else_location) && end_location\nelse\n issue_for(node, MSG)\n return\nend\nissue_for(location, cond_end_location, MSG) do |corrector|\n keyword_begin_pos = source.pos(location)\n keyword_end_pos = keyword_begin_pos + ({{ \"unless\".size }})\n keyword_range = keyword_begin_pos...keyword_end_pos\n cond_end_pos = source.pos(cond_end_location, end: true)\n else_begin_pos = source.pos(else_location)\n body_range = cond_end_pos...else_begin_pos\n else_end_pos = else_begin_pos + ({{ \"else\".size }})\n end_end_pos = source.pos(end_location, end: true)\n end_begin_pos = end_end_pos - ({{ \"end\".size }})\n else_range = else_end_pos...end_begin_pos\n corrector.replace(keyword_range, \"if\")\n corrector.replace(body_range, source.code[else_range])\n corrector.replace(else_range, source.code[body_range])\nend\n"}}]},{"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/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/style/verbose_block.cr","line_number":30,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/verbose_block.cr#L30"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"CALL_PATTERN","name":"CALL_PATTERN","value":"\"%s(%s&.%s)\""},{"id":"MSG","name":"MSG","value":"\"Use short block notation instead: `%s`\""}],"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"}],"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 ExcludeCallsWithBlock: 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":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"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 ExcludeCallsWithBlock: 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","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/6d03cef/src/ameba/rule/style/verbose_block.cr#L30"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method","name":"exclude_calls_with_block=","abstract":false,"args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"args_string":"(exclude_calls_with_block : Bool)","args_html":"(exclude_calls_with_block : Bool)","def":{"name":"exclude_calls_with_block=","args":[{"name":"exclude_calls_with_block","external_name":"exclude_calls_with_block","restriction":"Bool"}],"visibility":"Public","body":"@exclude_calls_with_block = exclude_calls_with_block"}},{"html_id":"exclude_calls_with_block?:Bool-instance-method","name":"exclude_calls_with_block?","abstract":false,"def":{"name":"exclude_calls_with_block?","return_type":"Bool","visibility":"Public","body":"@exclude_calls_with_block"}},{"html_id":"exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method","name":"exclude_multiple_line_blocks=","abstract":false,"args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"args_string":"(exclude_multiple_line_blocks : Bool)","args_html":"(exclude_multiple_line_blocks : Bool)","def":{"name":"exclude_multiple_line_blocks=","args":[{"name":"exclude_multiple_line_blocks","external_name":"exclude_multiple_line_blocks","restriction":"Bool"}],"visibility":"Public","body":"@exclude_multiple_line_blocks = exclude_multiple_line_blocks"}},{"html_id":"exclude_multiple_line_blocks?:Bool-instance-method","name":"exclude_multiple_line_blocks?","abstract":false,"def":{"name":"exclude_multiple_line_blocks?","return_type":"Bool","visibility":"Public","body":"@exclude_multiple_line_blocks"}},{"html_id":"exclude_operators=(exclude_operators:Bool)-instance-method","name":"exclude_operators=","abstract":false,"args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"args_string":"(exclude_operators : Bool)","args_html":"(exclude_operators : Bool)","def":{"name":"exclude_operators=","args":[{"name":"exclude_operators","external_name":"exclude_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_operators = exclude_operators"}},{"html_id":"exclude_operators?:Bool-instance-method","name":"exclude_operators?","abstract":false,"def":{"name":"exclude_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_operators"}},{"html_id":"exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method","name":"exclude_prefix_operators=","abstract":false,"args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"args_string":"(exclude_prefix_operators : Bool)","args_html":"(exclude_prefix_operators : Bool)","def":{"name":"exclude_prefix_operators=","args":[{"name":"exclude_prefix_operators","external_name":"exclude_prefix_operators","restriction":"Bool"}],"visibility":"Public","body":"@exclude_prefix_operators = exclude_prefix_operators"}},{"html_id":"exclude_prefix_operators?:Bool-instance-method","name":"exclude_prefix_operators?","abstract":false,"def":{"name":"exclude_prefix_operators?","return_type":"Bool","visibility":"Public","body":"@exclude_prefix_operators"}},{"html_id":"exclude_setters=(exclude_setters:Bool)-instance-method","name":"exclude_setters=","abstract":false,"args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"args_string":"(exclude_setters : Bool)","args_html":"(exclude_setters : Bool)","def":{"name":"exclude_setters=","args":[{"name":"exclude_setters","external_name":"exclude_setters","restriction":"Bool"}],"visibility":"Public","body":"@exclude_setters = exclude_setters"}},{"html_id":"exclude_setters?:Bool-instance-method","name":"exclude_setters?","abstract":false,"def":{"name":"exclude_setters?","return_type":"Bool","visibility":"Public","body":"@exclude_setters"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"max_length:Union(Int32,Nil)-instance-method","name":"max_length","abstract":false,"def":{"name":"max_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_length"}},{"html_id":"max_length=(max_length:Union(Int32,Nil))-instance-method","name":"max_length=","abstract":false,"args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_length : Union(Int32, Nil))","args_html":"(max_length : Union(Int32, Nil))","def":{"name":"max_length=","args":[{"name":"max_length","external_name":"max_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_length = max_length"}},{"html_id":"max_line_length:Union(Int32,Nil)-instance-method","name":"max_line_length","abstract":false,"def":{"name":"max_line_length","return_type":"::Union(Int32, ::Nil)","visibility":"Public","body":"@max_line_length"}},{"html_id":"max_line_length=(max_line_length:Union(Int32,Nil))-instance-method","name":"max_line_length=","abstract":false,"args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"args_string":"(max_line_length : Union(Int32, Nil))","args_html":"(max_line_length : Union(Int32, Nil))","def":{"name":"max_line_length=","args":[{"name":"max_line_length","external_name":"max_line_length","restriction":"::Union(Int32, ::Nil)"}],"visibility":"Public","body":"@max_line_length = max_line_length"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::Call)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","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":215,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/verbose_block.cr#L215"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::Call"}],"visibility":"Public","body":"if (block = node.block) && (block.args.size == 1)\nelse\n return\nend\narg = block.args.first\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, block, body)\n"}}]},{"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/6d03cef/src/ameba/rule/style/while_true.cr#L28"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"MSG","name":"MSG","value":"\"While statement using true literal as condition\""}],"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"}],"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

","class_methods":[{"html_id":"parsed_doc:String|Nil-class-method","name":"parsed_doc","doc":"Returns documentation for this rule, if there is 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 there is any.

","abstract":false,"def":{"name":"parsed_doc","return_type":"String | ::Nil","visibility":"Public","body":"@@parsed_doc"}}],"constructors":[{"html_id":"new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"new","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","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)","def":{"name":"new","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"new_from_yaml_node(ctx, node)"}},{"html_id":"new(config=nil)-class-method","name":"new","doc":"A rule that disallows the use of `while true` instead of using the idiomatic `loop`\n\nFor example, this is considered invalid:\n\n```\nwhile true\n do_something\n break if some_condition\nend\n```\n\nAnd should be replaced by the following:\n\n```\nloop do\n do_something\n break if some_condition\nend\n```\n\nYAML configuration example:\n\n```\nStyle/WhileTrue:\n Enabled: true\n```","summary":"

A rule that disallows the use of while true instead of using the idiomatic loop

","abstract":false,"args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"args_string":"(config = nil)","args_html":"(config = nil)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":28,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/while_true.cr#L28"},"def":{"name":"new","args":[{"name":"config","default_value":"nil","external_name":"config","restriction":""}],"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","abstract":false,"def":{"name":"description","return_type":"String","visibility":"Public","body":"@description"}},{"html_id":"description=(description:String)-instance-method","name":"description=","abstract":false,"args":[{"name":"description","external_name":"description","restriction":"String"}],"args_string":"(description : String)","args_html":"(description : String)","def":{"name":"description=","args":[{"name":"description","external_name":"description","restriction":"String"}],"visibility":"Public","body":"@description = description"}},{"html_id":"enabled=(enabled:Bool)-instance-method","name":"enabled=","abstract":false,"args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"args_string":"(enabled : Bool)","args_html":"(enabled : Bool)","def":{"name":"enabled=","args":[{"name":"enabled","external_name":"enabled","restriction":"::Bool"}],"visibility":"Public","body":"@enabled = enabled"}},{"html_id":"enabled?:Bool-instance-method","name":"enabled?","abstract":false,"def":{"name":"enabled?","visibility":"Public","body":"@enabled"}},{"html_id":"excluded:Array(String)|Nil-instance-method","name":"excluded","abstract":false,"def":{"name":"excluded","return_type":"Array(String) | ::Nil","visibility":"Public","body":"@excluded"}},{"html_id":"excluded=(excluded:Array(String)|Nil)-instance-method","name":"excluded=","abstract":false,"args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"args_string":"(excluded : Array(String) | Nil)","args_html":"(excluded : Array(String) | Nil)","def":{"name":"excluded=","args":[{"name":"excluded","external_name":"excluded","restriction":"Array(String) | ::Nil"}],"visibility":"Public","body":"@excluded = excluded"}},{"html_id":"severity:Ameba::Severity-instance-method","name":"severity","abstract":false,"def":{"name":"severity","visibility":"Public","body":"@severity"}},{"html_id":"severity=(severity:Ameba::Severity)-instance-method","name":"severity=","abstract":false,"args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"args_string":"(severity : Ameba::Severity)","args_html":"(severity : Ameba::Severity)","def":{"name":"severity=","args":[{"name":"severity","external_name":"severity","restriction":"::Ameba::Severity"}],"visibility":"Public","body":"@severity = severity"}},{"html_id":"test(source,node:Crystal::While)-instance-method","name":"test","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"args_string":"(source, node : Crystal::While)","args_html":"(source, node : Crystal::While)","location":{"filename":"src/ameba/rule/style/while_true.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/rule/style/while_true.cr#L35"},"def":{"name":"test","args":[{"name":"source","external_name":"source","restriction":""},{"name":"node","external_name":"node","restriction":"Crystal::While"}],"visibility":"Public","body":"if node.cond.true_literal?\nelse\n return\nend\nif location = node.location\nelse\n return\nend\nif end_location = node.cond.end_location\nelse\n return\nend\nissue_for(node, MSG) do |corrector|\n corrector.replace(location, end_location, \"loop do\")\nend\n"}}]}]}]},{"html_id":"ameba/Ameba/Runner","path":"Ameba/Runner.html","kind":"class","full_name":"Ameba::Runner","name":"Runner","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/runner.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L12"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Represents a runner for inspecting sources files.\nHolds a list of rules to do inspection based on,\nlist of sources to run inspection on and a formatter\nto prepare a report.\n\n```\nconfig = Ameba::Config.load\nrunner = Ameba::Runner.new config\nrunner.run.success? # => true or false\n```","summary":"

Represents a runner for inspecting sources files.

","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.

","abstract":false,"args":[{"name":"config","external_name":"config","restriction":"Config"}],"args_string":"(config : Config)","args_html":"(config : Config)","location":{"filename":"src/ameba/runner.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L61"},"def":{"name":"new","args":[{"name":"config","external_name":"config","restriction":"Config"}],"visibility":"Public","body":"_ = allocate\n_.initialize(config)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"explain(location,output=STDOUT)-instance-method","name":"explain","doc":"Explains an issue at a specified *location*.\n\nRunner should perform inspection before doing the explain.\nThis is necessary to be able to find the issue at a specified location.\n\n```\nrunner = Ameba::Runner.new config\nrunner.run\nrunner.explain({file: file, line: l, column: c})\n```","summary":"

Explains an issue at a specified location.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","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":160,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L160"},"def":{"name":"explain","args":[{"name":"location","external_name":"location","restriction":""},{"name":"output","default_value":"STDOUT","external_name":"output","restriction":""}],"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,"location":{"filename":"src/ameba/runner.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L87"},"def":{"name":"run","visibility":"Public","body":"begin\n @formatter.started(@sources)\n channels = @sources.map do\n Channel(Exception | ::Nil).new\n end\n (@sources.zip(channels)).each do |source, channel|\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,"location":{"filename":"src/ameba/runner.cr","line_number":35,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L35"},"def":{"name":"sources","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,"location":{"filename":"src/ameba/runner.cr","line_number":172,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L172"},"def":{"name":"success?","visibility":"Public","body":"@sources.all? do |source|\n source.issues.reject(&.disabled?).none?() do |__arg7|\n __arg7.rule.severity <= @severity\n end\nend"}}],"types":[{"html_id":"ameba/Ameba/Runner/InfiniteCorrectionLoopError","path":"Ameba/Runner/InfiniteCorrectionLoopError.html","kind":"class","full_name":"Ameba::Runner::InfiniteCorrectionLoopError","name":"InfiniteCorrectionLoopError","abstract":false,"superclass":{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},"ancestors":[{"html_id":"ameba/RuntimeError","kind":"class","full_name":"RuntimeError","name":"RuntimeError"},{"html_id":"ameba/SystemError","kind":"module","full_name":"SystemError","name":"SystemError"},{"html_id":"ameba/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"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/runner.cr","line_number":15,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L15"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Runner","kind":"class","full_name":"Ameba::Runner","name":"Runner"},"doc":"An error indicating that the inspection loop got stuck correcting\nissues back and forth.","summary":"

An error indicating that the inspection loop got stuck correcting issues back and forth.

","constructors":[{"html_id":"new(path,issues_by_iteration,loop_start=-1)-class-method","name":"new","abstract":false,"args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"args_string":"(path, issues_by_iteration, loop_start = -1)","args_html":"(path, issues_by_iteration, loop_start = -1)","location":{"filename":"src/ameba/runner.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/runner.cr#L16"},"def":{"name":"new","args":[{"name":"path","external_name":"path","restriction":""},{"name":"issues_by_iteration","external_name":"issues_by_iteration","restriction":""},{"name":"loop_start","default_value":"-1","external_name":"loop_start","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(path, issues_by_iteration, loop_start)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}]}]},{"html_id":"ameba/Ameba/Severity","path":"Ameba/Severity.html","kind":"enum","full_name":"Ameba::Severity","name":"Severity","abstract":false,"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":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L4"}],"repository_name":"ameba","program":false,"enum":true,"alias":false,"const":false,"constants":[{"id":"Error","name":"Error","value":"0"},{"id":"Warning","name":"Warning","value":"1"},{"id":"Convention","name":"Convention","value":"2"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"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","external_name":"name","restriction":"String"}],"args_string":"(name : String)","args_html":"(name : String)","location":{"filename":"src/ameba/severity.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L41"},"def":{"name":"parse","args":[{"name":"name","external_name":"name","restriction":"String"}],"visibility":"Public","body":"begin\n super(name)\nrescue ArgumentError\n raise(\"Incorrect severity name #{name}. Try one of: #{values.map(&.to_s).join(\", \")}\")\nend"}}],"instance_methods":[{"html_id":"color:Colorize::Color-instance-method","name":"color","doc":"Returns a color uniquely indicating severity.\n\n```\nSeverity::Warning.color # => Colorize::ColorANSI::Red\n```","summary":"

Returns a color uniquely indicating severity.

","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L27"},"def":{"name":"color","return_type":"Colorize::Color","visibility":"Public","body":"case self\nin Error\n Colorize::ColorANSI::Red\nin Warning\n Colorize::ColorANSI::Red\nin Convention\n Colorize::ColorANSI::Blue\nend"}},{"html_id":"convention?-instance-method","name":"convention?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":7,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L7"},"def":{"name":"convention?","visibility":"Public","body":"self == Convention"}},{"html_id":"error?-instance-method","name":"error?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":5,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L5"},"def":{"name":"error?","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,"location":{"filename":"src/ameba/severity.cr","line_number":14,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L14"},"def":{"name":"symbol","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?","abstract":false,"location":{"filename":"src/ameba/severity.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L6"},"def":{"name":"warning?","visibility":"Public","body":"self == Warning"}}]},{"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":49,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L49"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"Converter for `YAML.mapping` which converts severity enum to and from YAML.","summary":"

Converter for YAML.mapping which converts severity enum to and from YAML.

","class_methods":[{"html_id":"from_yaml(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method","name":"from_yaml","abstract":false,"args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"args_string":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","args_html":"(ctx : YAML::ParseContext, node : YAML::Nodes::Node)","location":{"filename":"src/ameba/severity.cr","line_number":50,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L50"},"def":{"name":"from_yaml","args":[{"name":"ctx","external_name":"ctx","restriction":"YAML::ParseContext"},{"name":"node","external_name":"node","restriction":"YAML::Nodes::Node"}],"visibility":"Public","body":"if node.is_a?(YAML::Nodes::Scalar)\nelse\n raise(\"Severity must be a scalar, not #{node.class}\")\nend\ncase value = node.value\nwhen String\n Severity.parse(value)\nwhen Nil\n raise(\"Missing severity\")\nelse\n raise(\"Incorrect severity: #{value}\")\nend\n"}},{"html_id":"to_yaml(value:Severity,yaml:YAML::Nodes::Builder)-class-method","name":"to_yaml","abstract":false,"args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"args_string":"(value : Severity, yaml : YAML::Nodes::Builder)","args_html":"(value : Severity, yaml : YAML::Nodes::Builder)","location":{"filename":"src/ameba/severity.cr","line_number":63,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/severity.cr#L63"},"def":{"name":"to_yaml","args":[{"name":"value","external_name":"value","restriction":"Severity"},{"name":"yaml","external_name":"yaml","restriction":"YAML::Nodes::Builder"}],"visibility":"Public","body":"yaml.scalar(value)"}}]},{"html_id":"ameba/Ameba/Source","path":"Ameba/Source.html","kind":"class","full_name":"Ameba::Source","name":"Source","abstract":false,"superclass":{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/AST/Util","kind":"module","full_name":"Ameba::AST::Util","name":"Util"},{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"ameba/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"src/ameba/source.cr","line_number":4,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L4"},{"filename":"src/ameba/source/corrector.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L3"},{"filename":"src/ameba/source/rewriter.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L1"},{"filename":"src/ameba/spec/support.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/support.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/InlineComments","kind":"module","full_name":"Ameba::InlineComments","name":"InlineComments"},{"html_id":"ameba/Ameba/Reportable","kind":"module","full_name":"Ameba::Reportable","name":"Reportable"},{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"doc":"An entity that represents a Crystal source file.\nHas path, lines of code and issues reported by rules.","summary":"

An entity that represents a Crystal source file.

","constructors":[{"html_id":"new(code:String,path:String=\"\",normalize=true)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"args_string":"(code : String, path : String = \"\", normalize = true)","args_html":"(code : String, path : String = "", normalize = true)","location":{"filename":"src/ameba/spec/support.cr","line_number":11,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/support.cr#L11"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"},{"name":"normalize","default_value":"true","external_name":"normalize","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path, normalize)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(code:String,path:String=\"\")-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.

","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"args_string":"(code : String, path : String = \"\")","args_html":"(code : String, path : String = "")","location":{"filename":"src/ameba/source.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L22"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code, path)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"ast:Crystal::ASTNode-instance-method","name":"ast","doc":"Returns AST nodes constructed by `Crystal::Parser`.\n\n```\nsource = Ameba::Source.new code, path\nsource.ast\n```","summary":"

Returns AST nodes constructed by Crystal::Parser.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L59"},"def":{"name":"ast","return_type":"Crystal::ASTNode","visibility":"Public","body":"if (value = @ast).nil?\n @ast = ((Crystal::Parser.new(code)).tap(&.wants_doc = true).tap(&.filename = path).parse)\nelse\n value\nend"}},{"html_id":"code:String-instance-method","name":"code","doc":"Crystal code (content of a source file).","summary":"

Crystal code (content of a source file).

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L12"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"correct?-instance-method","name":"correct?","doc":"Corrects any correctable issues and updates `code`.\nReturns `false` if no issues were corrected.","summary":"

Corrects any correctable issues and updates #code.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":27,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L27"},"def":{"name":"correct?","visibility":"Public","body":"corrector = Corrector.new(code)\nissues.each(&.correct(corrector))\ncorrected_code = corrector.process\nif code == corrected_code\n return false\nend\n@code = corrected_code\n@lines = nil\n@ast = nil\ntrue\n"}},{"html_id":"fullpath:String-instance-method","name":"fullpath","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":66,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L66"},"def":{"name":"fullpath","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 split 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```","summary":"

Returns lines of code split by new line character.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":51,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L51"},"def":{"name":"lines","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` otherwise.","summary":"

Returns true if filepath matches the source's path, false otherwise.

","abstract":false,"args":[{"name":"filepath","external_name":"filepath","restriction":""}],"args_string":"(filepath)","args_html":"(filepath)","location":{"filename":"src/ameba/source.cr","line_number":76,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L76"},"def":{"name":"matches_path?","args":[{"name":"filepath","external_name":"filepath","restriction":""}],"visibility":"Public","body":"fullpath == (File.expand_path(filepath))"}},{"html_id":"path:String-instance-method","name":"path","doc":"Path to the source file.","summary":"

Path to the source file.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L9"},"def":{"name":"path","return_type":"String","visibility":"Public","body":"@path"}},{"html_id":"pos(location:Crystal::Location,endend_pos=false):Int32-instance-method","name":"pos","doc":"Converts an AST location to a string position.","summary":"

Converts an AST location to a string position.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"args_string":"(location : Crystal::Location, end end_pos = false) : Int32","args_html":"(location : Crystal::Location, end end_pos = false) : Int32","location":{"filename":"src/ameba/source.cr","line_number":81,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L81"},"def":{"name":"pos","args":[{"name":"location","external_name":"location","restriction":"Crystal::Location"},{"name":"end_pos","default_value":"false","external_name":"end","restriction":""}],"return_type":"Int32","visibility":"Public","body":"line, column = location.line_number, location.column_number\npos = ((lines[0...(line - 1)].sum(&.size) + line) + column) - 2\nif end_pos\n pos = pos + 1\nend\npos\n"}},{"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.

","abstract":false,"location":{"filename":"src/ameba/source.cr","line_number":71,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source.cr#L71"},"def":{"name":"spec?","visibility":"Public","body":"path.ends_with?(\"_spec.cr\")"}}],"types":[{"html_id":"ameba/Ameba/Source/Corrector","path":"Ameba/Source/Corrector.html","kind":"class","full_name":"Ameba::Source::Corrector","name":"Corrector","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/source/corrector.cr","line_number":6,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L6"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class takes source code and rewrites it based\non the different correction actions supplied.","summary":"

This class takes source code and rewrites it based on the different correction actions supplied.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/corrector.cr","line_number":9,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L9"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"insert_after(location,end_location,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(location, end_location, nil, content)`","summary":"

Shortcut for #wrap(location, end_location, nil, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":65,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L65"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_after(range:Range(Int32,Int32),content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(range, nil, content)`","summary":"

Shortcut for #wrap(range, nil, content)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":70,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L70"},"def":{"name":"insert_after","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_after(begin_pos, end_pos, content)\n"}},{"html_id":"insert_after(pos:Int32,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(...pos, content)`","summary":"

Shortcut for #insert_after(...pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L92"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after(pos, content)"}},{"html_id":"insert_after(node:Crystal::ASTNode,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(node, nil, content)`","summary":"

Shortcut for #wrap(node, nil, content)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":164,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L164"},"def":{"name":"insert_after","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(end_location(node), content)"}},{"html_id":"insert_after(location,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(location, location, content)`","summary":"

Shortcut for #insert_after(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L87"},"def":{"name":"insert_after","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_after((loc_to_pos(location)) + 1, content)"}},{"html_id":"insert_before(location,end_location,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(location, end_location, content, nil)`","summary":"

Shortcut for #wrap(location, end_location, content, nil)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L53"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"insert_before(range:Range(Int32,Int32),content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(range, content, nil)`","summary":"

Shortcut for #wrap(range, content, nil)

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":58,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L58"},"def":{"name":"insert_before","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.insert_before(begin_pos, end_pos, content)\n"}},{"html_id":"insert_before(pos:Int32,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos.., content)`","summary":"

Shortcut for #insert_before(pos.., content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos : Int32, content)","args_html":"(pos : Int32, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":82,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L82"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":"Int32"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(pos, content)"}},{"html_id":"insert_before(node:Crystal::ASTNode,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(node, content, nil)`","summary":"

Shortcut for #wrap(node, content, nil)

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":159,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L159"},"def":{"name":"insert_before","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(location(node), content)"}},{"html_id":"insert_before(location,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(location, location, content)`","summary":"

Shortcut for #insert_before(location, location, content)

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, content)","args_html":"(location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":77,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L77"},"def":{"name":"insert_before","args":[{"name":"location","external_name":"location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.insert_before(loc_to_pos(location), content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/corrector.cr","line_number":196,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L196"},"def":{"name":"process","visibility":"Public","body":"@rewriter.process"}},{"html_id":"remove(location,end_location)-instance-method","name":"remove","doc":"Shortcut for `replace(location, end_location, \"\")`","summary":"

Shortcut for #replace(location, end_location, "")

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"args_string":"(location, end_location)","args_html":"(location, end_location)","location":{"filename":"src/ameba/source/corrector.cr","line_number":41,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L41"},"def":{"name":"remove","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove(range:Range(Int32,Int32))-instance-method","name":"remove","doc":"Shortcut for `replace(range, \"\")`","summary":"

Shortcut for #replace(range, "")

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"args_string":"(range : Range(Int32, Int32))","args_html":"(range : Range(Int32, Int32))","location":{"filename":"src/ameba/source/corrector.cr","line_number":46,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L46"},"def":{"name":"remove","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(begin_pos, end_pos)\n"}},{"html_id":"remove(node:Crystal::ASTNode)-instance-method","name":"remove","doc":"Shortcut for `replace(node, \"\")`","summary":"

Shortcut for #replace(node, "")

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"args_string":"(node : Crystal::ASTNode)","args_html":"(node : Crystal::ASTNode)","location":{"filename":"src/ameba/source/corrector.cr","line_number":154,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L154"},"def":{"name":"remove","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"}],"visibility":"Public","body":"remove(location(node), end_location(node))"}},{"html_id":"remove_leading(location,end_location,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L110"},"def":{"name":"remove_leading","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(loc_to_pos(location), (loc_to_pos(location)) + size)"}},{"html_id":"remove_leading(range:Range(Int32,Int32),size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the end of the range.","summary":"

Removes size characters from the beginning of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":115,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L115"},"def":{"name":"remove_leading","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos, begin_pos + size)\n"}},{"html_id":"remove_leading(node:Crystal::ASTNode,size)-instance-method","name":"remove_leading","doc":"Removes *size* characters from the beginning of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the end of the node.","summary":"

Removes size characters from the beginning of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":176,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L176"},"def":{"name":"remove_leading","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_leading(location(node), end_location(node), size)"}},{"html_id":"remove_preceding(location,end_location,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L97"},"def":{"name":"remove_preceding","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove((loc_to_pos(location)) - size, loc_to_pos(location))"}},{"html_id":"remove_preceding(range:Range(Int32,Int32),size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the source range.","summary":"

Removes size characters prior to the source range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L102"},"def":{"name":"remove_preceding","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"begin_pos = range.begin\n@rewriter.remove(begin_pos - size, begin_pos)\n"}},{"html_id":"remove_preceding(node:Crystal::ASTNode,size)-instance-method","name":"remove_preceding","doc":"Removes *size* characters prior to the given node.","summary":"

Removes size characters prior to the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":169,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L169"},"def":{"name":"remove_preceding","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_preceding(location(node), end_location(node), size)"}},{"html_id":"remove_trailing(location,end_location,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"args_string":"(location, end_location, size)","args_html":"(location, end_location, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":123,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L123"},"def":{"name":"remove_trailing","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"@rewriter.remove(((loc_to_pos(end_location)) + 1) - size, (loc_to_pos(end_location)) + 1)"}},{"html_id":"remove_trailing(range:Range(Int32,Int32),size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given range.\nIf *size* is greater than the size of the range, the removed region can\noverrun the beginning of the range.","summary":"

Removes size characters from the end of the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(range : Range(Int32, Int32), size)","args_html":"(range : Range(Int32, Int32), size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":128,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L128"},"def":{"name":"remove_trailing","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"end_pos = range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.remove(end_pos - size, end_pos)\n"}},{"html_id":"remove_trailing(node:Crystal::ASTNode,size)-instance-method","name":"remove_trailing","doc":"Removes *size* characters from the end of the given node.\nIf *size* is greater than the size of the node, the removed region can\noverrun the beginning of the node.","summary":"

Removes size characters from the end of the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"args_string":"(node : Crystal::ASTNode, size)","args_html":"(node : Crystal::ASTNode, size)","location":{"filename":"src/ameba/source/corrector.cr","line_number":183,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L183"},"def":{"name":"remove_trailing","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"size","external_name":"size","restriction":""}],"visibility":"Public","body":"remove_trailing(location(node), end_location(node), size)"}},{"html_id":"replace(location,end_location,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(location, end_location, content)","args_html":"(location, end_location, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":17,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L17"},"def":{"name":"replace","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"@rewriter.replace(loc_to_pos(location), (loc_to_pos(end_location)) + 1, content)"}},{"html_id":"replace(range:Range(Int32,Int32),content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(range : Range(Int32, Int32), content)","args_html":"(range : Range(Int32, Int32), content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":22,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L22"},"def":{"name":"replace","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.replace(begin_pos, end_pos, content)\n"}},{"html_id":"replace(node:Crystal::ASTNode,content)-instance-method","name":"replace","doc":"Replaces the code of the given node with *content*.","summary":"

Replaces the code of the given node with content.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"args_string":"(node : Crystal::ASTNode, content)","args_html":"(node : Crystal::ASTNode, content)","location":{"filename":"src/ameba/source/corrector.cr","line_number":144,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L144"},"def":{"name":"replace","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"replace(location(node), end_location(node), content)"}},{"html_id":"wrap(location,end_location,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(location, end_location, insert_before, insert_after)","args_html":"(location, end_location, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":29,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L29"},"def":{"name":"wrap","args":[{"name":"location","external_name":"location","restriction":""},{"name":"end_location","external_name":"end_location","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"@rewriter.wrap(loc_to_pos(location), (loc_to_pos(end_location)) + 1, insert_before, insert_after)"}},{"html_id":"wrap(range:Range(Int32,Int32),insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(range : Range(Int32, Int32), insert_before, insert_after)","args_html":"(range : Range(Int32, Int32), insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L34"},"def":{"name":"wrap","args":[{"name":"range","external_name":"range","restriction":"Range(Int32, Int32)"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"begin_pos, end_pos = range.begin, range.end\nif range.excludes_end?\nelse\n end_pos = end_pos - 1\nend\n@rewriter.wrap(begin_pos, end_pos, insert_before, insert_after)\n"}},{"html_id":"wrap(node:Crystal::ASTNode,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given node.","summary":"

Inserts the given strings before and after the given node.

","abstract":false,"args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(node : Crystal::ASTNode, insert_before, insert_after)","args_html":"(node : Crystal::ASTNode, insert_before, insert_after)","location":{"filename":"src/ameba/source/corrector.cr","line_number":149,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/corrector.cr#L149"},"def":{"name":"wrap","args":[{"name":"node","external_name":"node","restriction":"Crystal::ASTNode"},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"wrap(location(node), end_location(node), insert_before, insert_after)"}}]},{"html_id":"ameba/Ameba/Source/Rewriter","path":"Ameba/Source/Rewriter.html","kind":"class","full_name":"Ameba::Source::Rewriter","name":"Rewriter","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/source/rewriter.cr","line_number":61,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L61"},{"filename":"src/ameba/source/rewriter/action.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter/action.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Source","kind":"class","full_name":"Ameba::Source","name":"Source"},"doc":"This class performs the heavy lifting in the source rewriting process.\nIt schedules code updates to be performed in the correct order.\n\nFor simple cases, the resulting source will be obvious.\n\nExamples for more complex cases follow. Assume these examples are acting on\nthe source `puts(:hello, :world)`. The methods `#wrap`, `#remove`, etc.\nreceive a range as the first two arguments; for clarity, examples below use\nEnglish sentences and a string of raw code instead.\n\n## Overlapping deletions:\n\n* remove `:hello, `\n* remove `, :world`\n\nThe overlapping ranges are merged and `:hello, :world` will be removed.\n\n## Multiple actions at the same end points:\n\nResults will always be independent of the order they were given.\nException: rewriting actions done on exactly the same range (covered next).\n\nExample:\n\n* replace `, ` by ` => `\n* wrap `:hello, :world` with `{` and `}`\n* replace `:world` with `:everybody`\n* wrap `:world` with `[`, `]`\n\nThe resulting string will be `puts({:hello => [:everybody]})`\nand this result is independent of the order the instructions were given in.\n\n## Multiple wraps on same range:\n\n* wrap `:hello` with `(` and `)`\n* wrap `:hello` with `[` and `]`\n\nThe wraps are combined in order given and results would be `puts([(:hello)], :world)`.\n\n## Multiple replacements on same range:\n\n* replace `:hello` by `:hi`, then\n* replace `:hello` by `:hey`\n\nThe replacements are made in the order given, so the latter replacement\nsupersedes the former and `:hello` will be replaced by `:hey`.\n\n## Swallowed insertions:\n\n* wrap `world` by `__`, `__`\n* replace `:hello, :world` with `:hi`\n\nA containing replacement will swallow the contained rewriting actions\nand `:hello, :world` will be replaced by `:hi`.\n\n## Implementation\n\nThe updates are organized in a tree, according to the ranges they act on\n(where children are strictly contained by their parent).","summary":"

This class performs the heavy lifting in the source rewriting process.

","constructors":[{"html_id":"new(code:String)-class-method","name":"new","abstract":false,"args":[{"name":"code","external_name":"code","restriction":"::String"}],"args_string":"(code : String)","args_html":"(code : String)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":64,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L64"},"def":{"name":"new","args":[{"name":"code","external_name":"code","restriction":"::String"}],"visibility":"Public","body":"_ = allocate\n_.initialize(code)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"code:String-instance-method","name":"code","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":62,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L62"},"def":{"name":"code","return_type":"String","visibility":"Public","body":"@code"}},{"html_id":"empty?-instance-method","name":"empty?","doc":"Returns `true` if no (non trivial) update has been recorded","summary":"

Returns true if no (non trivial) update has been recorded

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":69,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L69"},"def":{"name":"empty?","visibility":"Public","body":"@action_root.empty?"}},{"html_id":"insert_after(begin_pos,end_pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `wrap(begin_pos, end_pos, nil, content)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, nil, content)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":97,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L97"},"def":{"name":"insert_after","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, nil, content)"}},{"html_id":"insert_after(pos,content)-instance-method","name":"insert_after","doc":"Shortcut for `insert_after(pos, pos, content)`","summary":"

Shortcut for #insert_after(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":107,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L107"},"def":{"name":"insert_after","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_after(pos, pos, content)"}},{"html_id":"insert_before(begin_pos,end_pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `wrap(begin_pos, end_pos, content, nil)`","summary":"

Shortcut for #wrap(begin_pos, end_pos, content, nil)

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":92,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L92"},"def":{"name":"insert_before","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"wrap(begin_pos, end_pos, content, nil)"}},{"html_id":"insert_before(pos,content)-instance-method","name":"insert_before","doc":"Shortcut for `insert_before(pos, pos, content)`","summary":"

Shortcut for #insert_before(pos, pos, content)

","abstract":false,"args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(pos, content)","args_html":"(pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":102,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L102"},"def":{"name":"insert_before","args":[{"name":"pos","external_name":"pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"insert_before(pos, pos, content)"}},{"html_id":"process-instance-method","name":"process","doc":"Applies all scheduled changes and returns modified source as a new string.","summary":"

Applies all scheduled changes and returns modified source as a new string.

","abstract":false,"location":{"filename":"src/ameba/source/rewriter.cr","line_number":112,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L112"},"def":{"name":"process","visibility":"Public","body":"String.build do |io|\n last_end = 0\n @action_root.ordered_replacements.each do |begin_pos, end_pos, replacement|\n (io << code[last_end...begin_pos]) << replacement\n last_end = end_pos\n end\n io << code[last_end...code.size]\nend"}},{"html_id":"remove(begin_pos,end_pos)-instance-method","name":"remove","doc":"Shortcut for `replace(begin_pos, end_pos, \"\")`","summary":"

Shortcut for #replace(begin_pos, end_pos, "")

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"args_string":"(begin_pos, end_pos)","args_html":"(begin_pos, end_pos)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":87,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L87"},"def":{"name":"remove","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""}],"visibility":"Public","body":"replace(begin_pos, end_pos, \"\")"}},{"html_id":"replace(begin_pos,end_pos,content)-instance-method","name":"replace","doc":"Replaces the code of the given range with *content*.","summary":"

Replaces the code of the given range with content.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"args_string":"(begin_pos, end_pos, content)","args_html":"(begin_pos, end_pos, content)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":74,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L74"},"def":{"name":"replace","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"content","external_name":"content","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, replacement: content.to_s)"}},{"html_id":"wrap(begin_pos,end_pos,insert_before,insert_after)-instance-method","name":"wrap","doc":"Inserts the given strings before and after the given range.","summary":"

Inserts the given strings before and after the given range.

","abstract":false,"args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"args_string":"(begin_pos, end_pos, insert_before, insert_after)","args_html":"(begin_pos, end_pos, insert_before, insert_after)","location":{"filename":"src/ameba/source/rewriter.cr","line_number":80,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/source/rewriter.cr#L80"},"def":{"name":"wrap","args":[{"name":"begin_pos","external_name":"begin_pos","restriction":""},{"name":"end_pos","external_name":"end_pos","restriction":""},{"name":"insert_before","external_name":"insert_before","restriction":""},{"name":"insert_after","external_name":"insert_after","restriction":""}],"visibility":"Public","body":"combine(begin_pos, end_pos, insert_before: insert_before.to_s, insert_after: insert_after.to_s)"}}]}]},{"html_id":"ameba/Ameba/Spec","path":"Ameba/Spec.html","kind":"module","full_name":"Ameba::Spec","name":"Spec","abstract":false,"locations":[{"filename":"src/ameba/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L2"},{"filename":"src/ameba/spec/be_valid.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba","kind":"module","full_name":"Ameba","name":"Ameba"},"types":[{"html_id":"ameba/Ameba/Spec/AnnotatedSource","path":"Ameba/Spec/AnnotatedSource.html","kind":"class","full_name":"Ameba::Spec::AnnotatedSource","name":"AnnotatedSource","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/spec/annotated_source.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"constants":[{"id":"ABBREV","name":"ABBREV","value":"\"[...]\""},{"id":"ANNOTATION_PATTERN_1","name":"ANNOTATION_PATTERN_1","value":"/\\A\\s*(# )?(\\^+|\\^{})( error:)? /"},{"id":"ANNOTATION_PATTERN_2","name":"ANNOTATION_PATTERN_2","value":"\" # error: \""}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Parsed representation of code annotated with the `# ^^^ error: Message` style","summary":"

Parsed representation of code annotated with the # ^^^ error: Message style

","class_methods":[{"html_id":"parse(annotated_code)-class-method","name":"parse","doc":"Separates annotation lines from code lines. Tracks the real\ncode line number that each annotation corresponds to.","summary":"

Separates annotation lines from code lines.

","abstract":false,"args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"args_string":"(annotated_code)","args_html":"(annotated_code)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":16,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L16"},"def":{"name":"parse","args":[{"name":"annotated_code","external_name":"annotated_code","restriction":""}],"visibility":"Public","body":"lines = [] of String\nannotations = [] of ::Tuple(Int32, String, String)\ncode_lines = annotated_code.split('\\n')\ncode_lines.each do |code_line|\n case\n when 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 when 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\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:Array(String),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.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"args_string":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","args_html":"(lines : Array(String), annotations : Enumerable(Tuple(Int32, String, String)))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":43,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L43"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"annotations","external_name":"annotations","restriction":"Enumerable(::Tuple(Int32, String, String))"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lines, annotations)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(lines:Array(String),issues:Enumerable(Issue))-class-method","name":"new","doc":"Annotates the source code with the Ameba issues provided.\n\nNOTE: Annotations are sorted so that reconstructing the annotation\n text via `#to_s` is deterministic.","summary":"

Annotates the source code with the Ameba issues provided.

","abstract":false,"args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"args_string":"(lines : Array(String), issues : Enumerable(Issue))","args_html":"(lines : Array(String), issues : Enumerable(Issue))","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":53,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L53"},"def":{"name":"new","args":[{"name":"lines","external_name":"lines","restriction":"::Array(::String)"},{"name":"issues","external_name":"issues","restriction":"Enumerable(Issue)"}],"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).

","abstract":false,"args":[{"name":"other","external_name":"other","restriction":""}],"args_string":"(other)","args_html":"(other)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":59,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L59"},"def":{"name":"==","args":[{"name":"other","external_name":"other","restriction":""}],"visibility":"Public","body":"(other.is_a?(AnnotatedSource) && (other.lines == lines)) && (match_annotations?(other))"}},{"html_id":"annotations:Array(Tuple(Int32,String,String))-instance-method","name":"annotations","doc":"Each entry is the line number, annotation prefix, and message.\nThe prefix is empty if the annotation is at the end of a code line.","summary":"

Each entry is the line number, annotation prefix, and message.

","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":12,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L12"},"def":{"name":"annotations","return_type":"Array(::Tuple(Int32, String, String))","visibility":"Public","body":"@annotations"}},{"html_id":"lines:Array(String)-instance-method","name":"lines","abstract":false,"location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L8"},"def":{"name":"lines","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","external_name":"io","restriction":""}],"args_string":"(io)","args_html":"(io)","location":{"filename":"src/ameba/spec/annotated_source.cr","line_number":110,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/annotated_source.cr#L110"},"def":{"name":"to_s","args":[{"name":"io","external_name":"io","restriction":""}],"visibility":"Public","body":"reconstructed = lines.dup\nannotations.reverse_each do |line_number, prefix, message|\n if prefix.empty?\n __temp_62 = line_number - 1\n reconstructed[__temp_62] = reconstructed[__temp_62] + \"#{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"}}]},{"html_id":"ameba/Ameba/Spec/BeValid","path":"Ameba/Spec/BeValid.html","kind":"module","full_name":"Ameba::Spec::BeValid","name":"BeValid","abstract":false,"locations":[{"filename":"src/ameba/spec/be_valid.cr","line_number":2,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L2"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"instance_methods":[{"html_id":"be_valid-instance-method","name":"be_valid","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":3,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L3"},"def":{"name":"be_valid","visibility":"Public","body":"BeValidExpectation.new"}}]},{"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/6d03cef/src/ameba/spec/be_valid.cr#L8"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"constructors":[{"html_id":"new-class-method","name":"new","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"new","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","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/spec/be_valid.cr#L13"},"def":{"name":"failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"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 |issue|\n str << \" * #{issue.rule.name}: #{issue.message}\\n\"\n end\nend"}},{"html_id":"initialize-instance-method","name":"initialize","abstract":false,"location":{"filename":"src/ameba/spec/be_valid.cr","line_number":8,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/be_valid.cr#L8"},"def":{"name":"initialize","visibility":"Public","body":""}},{"html_id":"match(source)-instance-method","name":"match","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/spec/be_valid.cr#L9"},"def":{"name":"match","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"source.valid?"}},{"html_id":"negative_failure_message(source)-instance-method","name":"negative_failure_message","abstract":false,"args":[{"name":"source","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/6d03cef/src/ameba/spec/be_valid.cr#L22"},"def":{"name":"negative_failure_message","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"\"Source expected to be invalid, but it is valid.\""}}]},{"html_id":"ameba/Ameba/Spec/ExpectIssue","path":"Ameba/Spec/ExpectIssue.html","kind":"module","full_name":"Ameba::Spec::ExpectIssue","name":"ExpectIssue","abstract":false,"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":96,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L96"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"included_modules":[{"html_id":"ameba/Ameba/Spec/Util","kind":"module","full_name":"Ameba::Spec::Util","name":"Util"}],"namespace":{"html_id":"ameba/Ameba/Spec","kind":"module","full_name":"Ameba::Spec","name":"Spec"},"doc":"Mixin for `expect_issue` and `expect_no_issues`\n\nThis 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, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\nEquivalent assertion without `expect_issue`:\n\n source = Source.new <<-CRYSTAL, \"source.cr\"\n a do\n b\n end.c\n CRYSTAL\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:3:1\"\n issue.end_location.to_s.should eq \"source.cr:3:5\"\n issue.message.should eq(\n \"Avoid chaining a method call on a do...end block.\"\n )\n\nAutocorrection can be tested using `expect_correction` after\n`expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n x % 2 == 0\n # ^^^^^^^^ error: Replace with `Int#even?`.\n CRYSTAL\n\n expect_correction source, <<-CRYSTAL\n x.even?\n CRYSTAL\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.\n\nIf the code produces an issue that could not be auto-corrected, you can\nuse `expect_no_corrections` after `expect_issue`.\n\n source = expect_issue subject, <<-CRYSTAL\n a do\n b\n end.c\n # ^^^ error: Avoid chaining a method call on a do...end block.\n CRYSTAL\n\n expect_no_corrections source\n\nIf your code has variables of different lengths, you can use `%{foo}`,\n`^{foo}`, and `_{foo}` to format your template; you can also abbreviate\nissue messages with `[...]`:\n\n %w[raise fail].each do |keyword|\n expect_issue subject, <<-CRYSTAL, keyword: keyword\n %{keyword} Exception.new(msg)\n # ^{keyword}^^^^^^^^^^^^^^^^^ error: Redundant `Exception.new` [...]\n CRYSTAL\n\n %w[has_one has_many].each do |type|\n expect_issue subject, <<-CRYSTAL, type: type\n class Book\n %{type} :chapter, foreign_key: \"book_id\"\n _{type} # ^^^^^^^^^^^^^^^^^^^^^^ error: Specifying the default [...]\n end\n CRYSTAL\n end\n\nIf you need to specify an issue on a blank line, use the empty `^{}` marker:\n\n expect_issue subject, <<-CRYSTAL\n\n # ^{} error: Missing frozen string literal comment.\n puts 1\n CRYSTAL","summary":"

Mixin for #expect_issue and #expect_no_issues

","instance_methods":[{"html_id":"expect_correction(source,correction,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_correction","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, correction, *, file = __FILE__, line = __LINE__)","args_html":"(source, correction, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":131,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L131"},"def":{"name":"expect_correction","args":[{"name":"source","external_name":"source","restriction":""},{"name":"correction","external_name":"correction","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":2,"visibility":"Public","body":"if source.correct?\nelse\n raise(\"Use `expect_no_corrections` if the code will not change\")\nend\nif correction == source.code\n return\nend\nfail(\"Expected correction:\\n\\n#{correction}\\n\\nGot:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_issue(rules:Rule::Base|Enumerable(Rule::Base),annotated_code:String,path=\"\",*,file=__FILE__,line=__LINE__,**replacements)-instance-method","name":"expect_issue","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = \"\", *, file = __FILE__, line = __LINE__, **replacements)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), annotated_code : String, path = "", *, file = __FILE__, line = __LINE__, **replacements)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":99,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L99"},"def":{"name":"expect_issue","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"annotated_code","external_name":"annotated_code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"double_splat":{"name":"replacements","external_name":"replacements","restriction":""},"splat_index":3,"visibility":"Public","body":"annotated_code = format_issue(annotated_code, **replacements)\nexpected_annotations = AnnotatedSource.parse(annotated_code)\nlines = expected_annotations.lines\ncode = lines.join('\\n')\nif code == annotated_code\n raise(\"Use `expect_no_issues` to assert that no issues are found\")\nend\nsource, actual_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\nsource\n"}},{"html_id":"expect_no_corrections(source,*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_corrections","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(source, *, file = __FILE__, line = __LINE__)","args_html":"(source, *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":146,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L146"},"def":{"name":"expect_no_corrections","args":[{"name":"source","external_name":"source","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":1,"visibility":"Public","body":"if source.correct?\nelse\n return\nend\nfail(\"Expected no corrections, but got:\\n\\n#{source.code}\", file, line)\n"}},{"html_id":"expect_no_issues(rules:Rule::Base|Enumerable(Rule::Base),code:String,path=\"\",*,file=__FILE__,line=__LINE__)-instance-method","name":"expect_no_issues","abstract":false,"args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"args_string":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = \"\", *, file = __FILE__, line = __LINE__)","args_html":"(rules : Rule::Base | Enumerable(Rule::Base), code : String, path = "", *, file = __FILE__, line = __LINE__)","location":{"filename":"src/ameba/spec/expect_issue.cr","line_number":156,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/expect_issue.cr#L156"},"def":{"name":"expect_no_issues","args":[{"name":"rules","external_name":"rules","restriction":"Rule::Base | Enumerable(Rule::Base)"},{"name":"code","external_name":"code","restriction":"String"},{"name":"path","default_value":"\"\"","external_name":"path","restriction":""},{"name":"","external_name":"","restriction":""},{"name":"file","default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","default_value":"__LINE__","external_name":"line","restriction":""}],"splat_index":3,"visibility":"Public","body":"lines = code.split('\\n')\n_, actual_annotations = actual_annotations(rules, code, path, lines)\nif actual_annotations.to_s == code\n return\nend\nfail(\"Expected no issues, but got:\\n\\n#{actual_annotations}\", file, line)\n"}}]},{"html_id":"ameba/Ameba/Spec/Util","path":"Ameba/Spec/Util.html","kind":"module","full_name":"Ameba::Spec::Util","name":"Util","abstract":false,"locations":[{"filename":"src/ameba/spec/util.cr","line_number":1,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/spec/util.cr#L1"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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"},"instance_methods":[{"html_id":"normalize_code(code,separator='\\n')-instance-method","name":"normalize_code","abstract":false,"args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","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/6d03cef/src/ameba/spec/util.cr#L2"},"def":{"name":"normalize_code","args":[{"name":"code","external_name":"code","restriction":""},{"name":"separator","default_value":"'\\n'","external_name":"separator","restriction":""}],"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"}}]}]},{"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":13,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L13"}],"repository_name":"ameba","program":false,"enum":false,"alias":false,"const":false,"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```","summary":"

Represents Crystal syntax tokenizer based on Crystal::Lexer.

","constructors":[{"html_id":"new(lexer:Crystal::Lexer)-class-method","name":"new","doc":"Instantiates Tokenizer using a `lexer`.\n\n```\nlexer = Crystal::Lexer.new(code)\nAmeba::Tokenizer.new(lexer)\n```","summary":"

Instantiates Tokenizer using a lexer.

","abstract":false,"args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"args_string":"(lexer : Crystal::Lexer)","args_html":"(lexer : Crystal::Lexer)","location":{"filename":"src/ameba/tokenizer.cr","line_number":34,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L34"},"def":{"name":"new","args":[{"name":"lexer","external_name":"lexer","restriction":"Crystal::Lexer"}],"visibility":"Public","body":"_ = allocate\n_.initialize(lexer)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}},{"html_id":"new(source)-class-method","name":"new","doc":"Instantiates Tokenizer using a `source`.\n\n```\nsource = Ameba::Source.new code, path\nAmeba::Tokenizer.new(source)\n```","summary":"

Instantiates Tokenizer using a source.

","abstract":false,"args":[{"name":"source","external_name":"source","restriction":""}],"args_string":"(source)","args_html":"(source)","location":{"filename":"src/ameba/tokenizer.cr","line_number":20,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L20"},"def":{"name":"new","args":[{"name":"source","external_name":"source","restriction":""}],"visibility":"Public","body":"_ = allocate\n_.initialize(source)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"html_id":"run(&block:Crystal::Token->_)-instance-method","name":"run","doc":"Runs the tokenizer and yields each token as a block argument.\n\n```\nAmeba::Tokenizer.new(source).run do |token|\n puts token\nend\n```","summary":"

Runs the tokenizer and yields each token as a block argument.

","abstract":false,"location":{"filename":"src/ameba/tokenizer.cr","line_number":44,"url":"https://github.com/crystal-ameba/ameba/blob/6d03cef/src/ameba/tokenizer.cr#L44"},"def":{"name":"run","yields":1,"block_arity":1,"block_arg":{"name":"block","external_name":"block","restriction":"(Crystal::Token -> _)"},"visibility":"Public","body":"begin\n run_normal_state(@lexer, &block)\n true\nrescue e : Crystal::SyntaxException\n false\nend"}}]}]}]}}) \ No newline at end of file