Deploying to gh-pages from @ 48b15b9bf8 🚀

This commit is contained in:
Sija 2021-10-19 09:45:33 +00:00
parent 42809c9681
commit f760465482
106 changed files with 5612 additions and 4623 deletions

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,19 +645,13 @@
</h2>
<p>A rule that enforces constant names to be in screaming case.</p>
<p>For example, these constant names are considered valid:</p>
<pre><code class="language-crystal"><span class="t">LUCKY_NUMBERS</span> <span class="o">=</span> [<span class="n">3</span>, <span class="n">7</span>, <span class="n">11</span>]
<span class="t">DOCUMENTATION_URL</span> <span class="o">=</span> <span class="s">&quot;http://crystal-lang.org/docs&quot;</span></code></pre>
<p>And these are invalid names:</p>
<pre><code class="language-crystal">myBadConstant <span class="o">=</span> <span class="n">1</span>
<span class="t">Wrong_NAME</span> <span class="o">=</span> <span class="n">2</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/ConstantNames:
Enabled: true</code></pre>
@ -695,7 +694,7 @@
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/constant_names.cr#L24" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/constant_names.cr#L24" target="_blank">
ameba/rule/style/constant_names.cr
</a>
@ -736,12 +735,12 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that enforces constant names to be in screaming case.</p></div>
@ -764,47 +763,47 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Assign)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Assign)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AAssign%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Assign)</a>
</li>
@ -841,17 +840,17 @@
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -871,12 +870,12 @@
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -946,7 +945,7 @@
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -960,25 +959,19 @@
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that enforces constant names to be in screaming case.</p>
<p>For example, these constant names are considered valid:</p>
<pre><code class="language-crystal"><span class="t">LUCKY_NUMBERS</span> <span class="o">=</span> [<span class="n">3</span>, <span class="n">7</span>, <span class="n">11</span>]
<span class="t">DOCUMENTATION_URL</span> <span class="o">=</span> <span class="s">&quot;http://crystal-lang.org/docs&quot;</span></code></pre>
<p>And these are invalid names:</p>
<pre><code class="language-crystal">myBadConstant <span class="o">=</span> <span class="n">1</span>
<span class="t">Wrong_NAME</span> <span class="o">=</span> <span class="n">2</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/ConstantNames:
Enabled: true</code></pre>
</div>
@ -986,7 +979,7 @@
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/constant_names.cr#L24" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/constant_names.cr#L24" target="_blank">View source</a>]
</div>
</div>
@ -1010,7 +1003,7 @@
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1024,7 +1017,7 @@
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1038,7 +1031,7 @@
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1052,7 +1045,7 @@
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1066,7 +1059,7 @@
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1080,7 +1073,7 @@
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1094,7 +1087,7 @@
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1108,7 +1101,7 @@
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1122,13 +1115,13 @@
def <strong>test</strong>(source, node : Crystal::Assign)
<a class="method-permalink" href="#test(source,node:Crystal::Assign)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AAssign%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/constant_names.cr#L31" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/constant_names.cr#L31" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,9 +645,7 @@
</h2>
<p>This rule is used to identify usage of <code>is_a?/nil?</code> calls within filters.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal">matches <span class="o">=</span> <span class="s">%w[Alice Bob]</span>.map(<span class="o">&amp;</span>.match(<span class="s">/^A./</span>))
matches.any?(<span class="o">&amp;</span>.<span class="k">is_a?</span>(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>)) <span class="c"># =&gt; true</span>
@ -650,9 +653,7 @@ matches.one?(<span class="o">&amp;</span>.<span class="k">nil?</span>)
<span class="k">typeof</span>(matches.reject(<span class="o">&amp;</span>.<span class="k">nil?</span>)) <span class="c"># =&gt; Array(Regex::MatchData | Nil)</span>
<span class="k">typeof</span>(matches.<span class="k">select</span>(<span class="o">&amp;</span>.<span class="k">is_a?</span>(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>))) <span class="c"># =&gt; Array(Regex::MatchData | Nil)</span></code></pre>
<p>And it should be written as this:</p>
<pre><code class="language-crystal">matches <span class="o">=</span> <span class="s">%w[Alice Bob]</span>.map(<span class="o">&amp;</span>.match(<span class="s">/^A./</span>))
matches.any?(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>) <span class="c"># =&gt; true</span>
@ -660,9 +661,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
<span class="k">typeof</span>(matches.reject(<span class="t">Nil</span>)) <span class="c"># =&gt; Array(Regex::MatchData)</span>
<span class="k">typeof</span>(matches.<span class="k">select</span>(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>)) <span class="c"># =&gt; Array(Regex::MatchData)</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/IsAFilter:
Enabled: true
FilterNames:
@ -712,7 +711,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/is_a_filter.cr#L41" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_filter.cr#L41" target="_blank">
ameba/rule/style/is_a_filter.cr
</a>
@ -753,12 +752,12 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>This rule is used to identify usage of <code>is_a?/nil?</code> calls within filters.</p></div>
@ -781,62 +780,62 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#filter_names:Array(String)-instance-method" class="signature"><strong>#filter_names</strong> : Array(String)</a>
<a href="#filter_names%3AArray%28String%29-instance-method" class="signature"><strong>#filter_names</strong> : Array(String)</a>
</li>
<li class="entry-summary">
<a href="#filter_names=(filter_names:Array(String))-instance-method" class="signature"><strong>#filter_names=</strong>(filter_names : Array(String))</a>
<a href="#filter_names%3D%28filter_names%3AArray%28String%29%29-instance-method" class="signature"><strong>#filter_names=</strong>(filter_names : Array(String))</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Call)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Call)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ACall%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Call)</a>
</li>
<li class="entry-summary">
<a href="#test(source)-instance-method" class="signature"><strong>#test</strong>(source)</a>
<a href="#test%28source%29-instance-method" class="signature"><strong>#test</strong>(source)</a>
</li>
@ -873,17 +872,17 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -903,12 +902,12 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -978,7 +977,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -992,15 +991,13 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>This rule is used to identify usage of <code>is_a?/nil?</code> calls within filters.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal">matches <span class="o">=</span> <span class="s">%w[Alice Bob]</span>.map(<span class="o">&amp;</span>.match(<span class="s">/^A./</span>))
matches.any?(<span class="o">&amp;</span>.<span class="k">is_a?</span>(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>)) <span class="c"># =&gt; true</span>
@ -1008,9 +1005,7 @@ matches.one?(<span class="o">&amp;</span>.<span class="k">nil?</span>)
<span class="k">typeof</span>(matches.reject(<span class="o">&amp;</span>.<span class="k">nil?</span>)) <span class="c"># =&gt; Array(Regex::MatchData | Nil)</span>
<span class="k">typeof</span>(matches.<span class="k">select</span>(<span class="o">&amp;</span>.<span class="k">is_a?</span>(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>))) <span class="c"># =&gt; Array(Regex::MatchData | Nil)</span></code></pre>
<p>And it should be written as this:</p>
<pre><code class="language-crystal">matches <span class="o">=</span> <span class="s">%w[Alice Bob]</span>.map(<span class="o">&amp;</span>.match(<span class="s">/^A./</span>))
matches.any?(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>) <span class="c"># =&gt; true</span>
@ -1018,9 +1013,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
<span class="k">typeof</span>(matches.reject(<span class="t">Nil</span>)) <span class="c"># =&gt; Array(Regex::MatchData)</span>
<span class="k">typeof</span>(matches.<span class="k">select</span>(<span class="t">Regex</span><span class="t">::</span><span class="t">MatchData</span>)) <span class="c"># =&gt; Array(Regex::MatchData)</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/IsAFilter:
Enabled: true
FilterNames:
@ -1035,7 +1028,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/is_a_filter.cr#L41" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_filter.cr#L41" target="_blank">View source</a>]
</div>
</div>
@ -1059,7 +1052,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1073,7 +1066,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1087,7 +1080,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1101,7 +1094,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1115,7 +1108,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1129,7 +1122,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1143,7 +1136,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>filter_names</strong> : Array(String)
<a class="method-permalink" href="#filter_names:Array(String)-instance-method">#</a>
<a class="method-permalink" href="#filter_names%3AArray%28String%29-instance-method">#</a>
</div>
<br/>
@ -1157,7 +1150,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>filter_names=</strong>(filter_names : Array(String))
<a class="method-permalink" href="#filter_names=(filter_names:Array(String))-instance-method">#</a>
<a class="method-permalink" href="#filter_names%3D%28filter_names%3AArray%28String%29%29-instance-method">#</a>
</div>
<br/>
@ -1171,7 +1164,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1185,7 +1178,7 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1199,13 +1192,13 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>test</strong>(source, node : Crystal::Call)
<a class="method-permalink" href="#test(source,node:Crystal::Call)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ACall%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/is_a_filter.cr#L58" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_filter.cr#L58" target="_blank">View source</a>]
</div>
</div>
@ -1215,13 +1208,13 @@ matches.one?(<span class="t">Nil</span>) <span class="c"># =&gt; tr
def <strong>test</strong>(source)
<a class="method-permalink" href="#test(source)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/is_a_filter.cr#L49" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_filter.cr#L49" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,17 +645,11 @@
</h2>
<p>A rule that disallows calls to <code>is_a?(Nil)</code> in favor of <code>nil?</code>.</p>
<p>This is considered bad:</p>
<pre><code class="language-crystal">var.<span class="k">is_a?</span>(<span class="t">Nil</span>)</code></pre>
<p>And needs to be written as:</p>
<pre><code class="language-crystal">var.<span class="k">nil?</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/IsANil:
Enabled: true</code></pre>
@ -693,7 +692,7 @@
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/is_a_nil.cr#L22" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_nil.cr#L22" target="_blank">
ameba/rule/style/is_a_nil.cr
</a>
@ -739,12 +738,12 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows calls to <code>is_a?(Nil)</code> in favor of <code>nil?</code>.</p></div>
@ -767,47 +766,47 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::IsA)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::IsA)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AIsA%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::IsA)</a>
</li>
@ -844,17 +843,17 @@
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -874,12 +873,12 @@
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -949,7 +948,7 @@
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -963,23 +962,17 @@
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that disallows calls to <code>is_a?(Nil)</code> in favor of <code>nil?</code>.</p>
<p>This is considered bad:</p>
<pre><code class="language-crystal">var.<span class="k">is_a?</span>(<span class="t">Nil</span>)</code></pre>
<p>And needs to be written as:</p>
<pre><code class="language-crystal">var.<span class="k">nil?</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/IsANil:
Enabled: true</code></pre>
</div>
@ -987,7 +980,7 @@
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/is_a_nil.cr#L22" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_nil.cr#L22" target="_blank">View source</a>]
</div>
</div>
@ -1011,7 +1004,7 @@
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1025,7 +1018,7 @@
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1039,7 +1032,7 @@
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1053,7 +1046,7 @@
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1067,7 +1060,7 @@
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1081,7 +1074,7 @@
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1095,7 +1088,7 @@
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1109,7 +1102,7 @@
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1123,13 +1116,13 @@
def <strong>test</strong>(source, node : Crystal::IsA)
<a class="method-permalink" href="#test(source,node:Crystal::IsA)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AIsA%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/is_a_nil.cr#L30" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/is_a_nil.cr#L30" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -642,21 +647,15 @@
<p>A rule that disallows usage of large numbers without underscore.
These do not affect the value of the number, but can help read
large numbers more easily.</p>
<p>For example, these are considered invalid:</p>
<pre><code class="language-crystal"><span class="n">10000</span>
<span class="n">141592654</span>
<span class="n">5.12345</span></code></pre>
<p>And has to be rewritten as the following:</p>
<pre><code class="language-crystal"><span class="n">10_000</span>
<span class="n">141_592_654</span>
<span class="n">5.123_45</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/LargeNumbers:
Enabled: true
IntMinDigits: 5 # i.e. integers higher than 9999</code></pre>
@ -700,7 +699,7 @@ large numbers more easily.</p>
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/large_numbers.cr#L29" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/large_numbers.cr#L29" target="_blank">
ameba/rule/style/large_numbers.cr
</a>
@ -741,12 +740,12 @@ large numbers more easily.</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows usage of large numbers without underscore.</p></div>
@ -769,57 +768,57 @@ large numbers more easily.</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled:Bool)-instance-method" class="signature"><strong>#enabled=</strong>(enabled : Bool)</a>
<a href="#enabled%3D%28enabled%3ABool%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled : Bool)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#int_min_digits:Int32-instance-method" class="signature"><strong>#int_min_digits</strong> : Int32</a>
<a href="#int_min_digits%3AInt32-instance-method" class="signature"><strong>#int_min_digits</strong> : Int32</a>
</li>
<li class="entry-summary">
<a href="#int_min_digits=(int_min_digits:Int32)-instance-method" class="signature"><strong>#int_min_digits=</strong>(int_min_digits : Int32)</a>
<a href="#int_min_digits%3D%28int_min_digits%3AInt32%29-instance-method" class="signature"><strong>#int_min_digits=</strong>(int_min_digits : Int32)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source)-instance-method" class="signature"><strong>#test</strong>(source)</a>
<a href="#test%28source%29-instance-method" class="signature"><strong>#test</strong>(source)</a>
</li>
@ -856,17 +855,17 @@ large numbers more easily.</p>
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -886,12 +885,12 @@ large numbers more easily.</p>
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -961,7 +960,7 @@ large numbers more easily.</p>
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -975,7 +974,7 @@ large numbers more easily.</p>
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
@ -983,21 +982,15 @@ large numbers more easily.</p>
<p>A rule that disallows usage of large numbers without underscore.
These do not affect the value of the number, but can help read
large numbers more easily.</p>
<p>For example, these are considered invalid:</p>
<pre><code class="language-crystal"><span class="n">10000</span>
<span class="n">141592654</span>
<span class="n">5.12345</span></code></pre>
<p>And has to be rewritten as the following:</p>
<pre><code class="language-crystal"><span class="n">10_000</span>
<span class="n">141_592_654</span>
<span class="n">5.123_45</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/LargeNumbers:
Enabled: true
IntMinDigits: 5 # i.e. integers higher than 9999</code></pre>
@ -1006,7 +999,7 @@ large numbers more easily.</p>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/large_numbers.cr#L29" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/large_numbers.cr#L29" target="_blank">View source</a>]
</div>
</div>
@ -1030,7 +1023,7 @@ large numbers more easily.</p>
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1044,7 +1037,7 @@ large numbers more easily.</p>
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1058,7 +1051,7 @@ large numbers more easily.</p>
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1072,7 +1065,7 @@ large numbers more easily.</p>
def <strong>enabled=</strong>(enabled : Bool)
<a class="method-permalink" href="#enabled=(enabled:Bool)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1086,7 +1079,7 @@ large numbers more easily.</p>
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1100,7 +1093,7 @@ large numbers more easily.</p>
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1114,7 +1107,7 @@ large numbers more easily.</p>
def <strong>int_min_digits</strong> : Int32
<a class="method-permalink" href="#int_min_digits:Int32-instance-method">#</a>
<a class="method-permalink" href="#int_min_digits%3AInt32-instance-method">#</a>
</div>
<br/>
@ -1128,7 +1121,7 @@ large numbers more easily.</p>
def <strong>int_min_digits=</strong>(int_min_digits : Int32)
<a class="method-permalink" href="#int_min_digits=(int_min_digits:Int32)-instance-method">#</a>
<a class="method-permalink" href="#int_min_digits%3D%28int_min_digits%3AInt32%29-instance-method">#</a>
</div>
<br/>
@ -1142,7 +1135,7 @@ large numbers more easily.</p>
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1156,7 +1149,7 @@ large numbers more easily.</p>
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1170,13 +1163,13 @@ large numbers more easily.</p>
def <strong>test</strong>(source)
<a class="method-permalink" href="#test(source)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/large_numbers.cr#L38" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/large_numbers.cr#L38" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,9 +645,7 @@
</h2>
<p>A rule that enforces method names to be in underscored case.</p>
<p>For example, these are considered valid:</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">Person</span>
<span class="k">def</span> <span class="m">first_name</span>
<span class="k">end</span>
@ -653,9 +656,7 @@
<span class="k">def</span> <span class="m">homepage_url</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>And these are invalid method names:</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">Person</span>
<span class="k">def</span> <span class="m">firstName</span>
<span class="k">end</span>
@ -666,9 +667,7 @@
<span class="k">def</span> <span class="m">homepageURL</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/MethodNames:
Enabled: true</code></pre>
@ -711,7 +710,7 @@
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/method_names.cr#L40" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L40" target="_blank">
ameba/rule/style/method_names.cr
</a>
@ -752,12 +751,12 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that enforces method names to be in underscored case.</p></div>
@ -780,47 +779,47 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Def)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
</li>
@ -857,17 +856,17 @@
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -887,12 +886,12 @@
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -962,7 +961,7 @@
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -976,15 +975,13 @@
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that enforces method names to be in underscored case.</p>
<p>For example, these are considered valid:</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">Person</span>
<span class="k">def</span> <span class="m">first_name</span>
<span class="k">end</span>
@ -995,9 +992,7 @@
<span class="k">def</span> <span class="m">homepage_url</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>And these are invalid method names:</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">Person</span>
<span class="k">def</span> <span class="m">firstName</span>
<span class="k">end</span>
@ -1008,9 +1003,7 @@
<span class="k">def</span> <span class="m">homepageURL</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/MethodNames:
Enabled: true</code></pre>
</div>
@ -1018,7 +1011,7 @@
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/method_names.cr#L40" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L40" target="_blank">View source</a>]
</div>
</div>
@ -1042,7 +1035,7 @@
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1056,7 +1049,7 @@
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1070,7 +1063,7 @@
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1084,7 +1077,7 @@
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1098,7 +1091,7 @@
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1112,7 +1105,7 @@
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1126,7 +1119,7 @@
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1140,7 +1133,7 @@
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1154,13 +1147,13 @@
def <strong>test</strong>(source, node : Crystal::Def)
<a class="method-permalink" href="#test(source,node:Crystal::Def)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/method_names.cr#L47" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/method_names.cr#L47" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,24 +645,17 @@
</h2>
<p>A rule that disallows negated conditions in unless.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">unless</span> <span class="o">!</span>s.empty?
<span class="n">:ok</span>
<span class="k">end</span></code></pre>
<p>And should be rewritten to the following:</p>
<pre><code class="language-crystal"><span class="k">if</span> s.emtpy?
<span class="n">:ok</span>
<span class="k">end</span></code></pre>
<p>It is pretty difficult to wrap your head around a block of code
that is executed if a negated condition is NOT met.</p>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/NegatedConditionsInUnless:
Enabled: true</code></pre>
@ -700,7 +698,7 @@ that is executed if a negated condition is NOT met.</p>
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29" target="_blank">
ameba/rule/style/negated_conditions_in_unless.cr
</a>
@ -741,12 +739,12 @@ that is executed if a negated condition is NOT met.</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows negated conditions in unless.</p></div>
@ -769,47 +767,47 @@ that is executed if a negated condition is NOT met.</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Unless)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Unless)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AUnless%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Unless)</a>
</li>
@ -846,17 +844,17 @@ that is executed if a negated condition is NOT met.</p>
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -876,12 +874,12 @@ that is executed if a negated condition is NOT met.</p>
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -951,7 +949,7 @@ that is executed if a negated condition is NOT met.</p>
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -965,30 +963,23 @@ that is executed if a negated condition is NOT met.</p>
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that disallows negated conditions in unless.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">unless</span> <span class="o">!</span>s.empty?
<span class="n">:ok</span>
<span class="k">end</span></code></pre>
<p>And should be rewritten to the following:</p>
<pre><code class="language-crystal"><span class="k">if</span> s.emtpy?
<span class="n">:ok</span>
<span class="k">end</span></code></pre>
<p>It is pretty difficult to wrap your head around a block of code
that is executed if a negated condition is NOT met.</p>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/NegatedConditionsInUnless:
Enabled: true</code></pre>
</div>
@ -996,7 +987,7 @@ that is executed if a negated condition is NOT met.</p>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L29" target="_blank">View source</a>]
</div>
</div>
@ -1020,7 +1011,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1034,7 +1025,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1048,7 +1039,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1062,7 +1053,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1076,7 +1067,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1090,7 +1081,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1104,7 +1095,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1118,7 +1109,7 @@ that is executed if a negated condition is NOT met.</p>
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1132,13 +1123,13 @@ that is executed if a negated condition is NOT met.</p>
def <strong>test</strong>(source, node : Crystal::Unless)
<a class="method-permalink" href="#test(source,node:Crystal::Unless)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AUnless%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/negated_conditions_in_unless.cr#L36" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/negated_conditions_in_unless.cr#L36" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -641,25 +646,19 @@
<p>A rule that disallows tautological predicate names, meaning those that
start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores if the alternative isn't valid Crystal code (e.g. <code>is_404?</code>).</p>
<p>Favour these:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">valid?</span>(x)
<span class="k">end</span>
<span class="k">def</span> <span class="m">picture?</span>(x)
<span class="k">end</span></code></pre>
<p>Over these:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">is_valid?</span>(x)
<span class="k">end</span>
<span class="k">def</span> <span class="m">has_picture?</span>(x)
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/PredicateName:
Enabled: true</code></pre>
@ -702,7 +701,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/predicate_name.cr#L31" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/predicate_name.cr#L31" target="_blank">
ameba/rule/style/predicate_name.cr
</a>
@ -743,12 +742,12 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows tautological predicate names, meaning those that start with the prefix <code>has_</code> or the prefix <code>is_</code>.</p></div>
@ -771,47 +770,47 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled:Bool)-instance-method" class="signature"><strong>#enabled=</strong>(enabled : Bool)</a>
<a href="#enabled%3D%28enabled%3ABool%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled : Bool)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Def)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
</li>
@ -848,17 +847,17 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -878,12 +877,12 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -953,7 +952,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -967,32 +966,26 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that disallows tautological predicate names, meaning those that
start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores if the alternative isn't valid Crystal code (e.g. <code>is_404?</code>).</p>
<p>Favour these:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">valid?</span>(x)
<span class="k">end</span>
<span class="k">def</span> <span class="m">picture?</span>(x)
<span class="k">end</span></code></pre>
<p>Over these:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">is_valid?</span>(x)
<span class="k">end</span>
<span class="k">def</span> <span class="m">has_picture?</span>(x)
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/PredicateName:
Enabled: true</code></pre>
</div>
@ -1000,7 +993,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/predicate_name.cr#L31" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/predicate_name.cr#L31" target="_blank">View source</a>]
</div>
</div>
@ -1024,7 +1017,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1038,7 +1031,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1052,7 +1045,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1066,7 +1059,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>enabled=</strong>(enabled : Bool)
<a class="method-permalink" href="#enabled=(enabled:Bool)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1080,7 +1073,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1094,7 +1087,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1108,7 +1101,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1122,7 +1115,7 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1136,13 +1129,13 @@ start with the prefix <code>has_</code> or the prefix <code>is_</code>. Ignores
def <strong>test</strong>(source, node : Crystal::Def)
<a class="method-permalink" href="#test(source,node:Crystal::Def)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/predicate_name.cr#L39" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/predicate_name.cr#L39" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,13 +645,11 @@
</h2>
<p>A rule that disallows redundant begin blocks.</p>
<p>Currently it is able to detect:</p>
<ol><li>Exception handler block that can be used as a part of the method.</li></ol>
<ol>
<li>Exception handler block that can be used as a part of the method.</li>
</ol>
<p>For example, this:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
<span class="k">begin</span>
read_content
@ -654,35 +657,28 @@
close_file
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>should be rewritten as:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
read_content
<span class="k">rescue</span>
close_file
<span class="k">end</span></code></pre>
<ol><li>begin..end block as a top level block in a method.</li></ol>
<ol start="2">
<li>begin..end block as a top level block in a method.</li>
</ol>
<p>For example this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
<span class="k">begin</span>
a <span class="o">=</span> <span class="n">1</span>
b <span class="o">=</span> <span class="n">2</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>and has to be written as the following:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
a <span class="o">=</span> <span class="n">1</span>
b <span class="o">=</span> <span class="n">2</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/RedundantBegin:
Enabled: true</code></pre>
@ -727,7 +723,7 @@
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_begin.cr#L58" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_begin.cr#L58" target="_blank">
ameba/rule/style/redundant_begin.cr
</a>
@ -768,12 +764,12 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows redundant begin blocks.</p></div>
@ -796,47 +792,47 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Def)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
</li>
@ -853,44 +849,49 @@
<h3>Instance methods inherited from module <code><a href="../../../Ameba/AST/Util.html">Ameba::AST::Util</a></code></h3>
<a href="../../../Ameba/AST/Util.html#abort?(node)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#abort%3F%28node%29-instance-method" class="tooltip">
<span>abort?(node)</span>
abort?</a>,
<a href="../../../Ameba/AST/Util.html#exit?(node)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#exit%3F%28node%29-instance-method" class="tooltip">
<span>exit?(node)</span>
exit?</a>,
<a href="../../../Ameba/AST/Util.html#flow_command?(node,in_loop)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#flow_command%3F%28node%2Cin_loop%29-instance-method" class="tooltip">
<span>flow_command?(node, in_loop)</span>
flow_command?</a>,
<a href="../../../Ameba/AST/Util.html#flow_expression?(node,in_loop=false)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#flow_expression%3F%28node%2Cin_loop%3Dfalse%29-instance-method" class="tooltip">
<span>flow_expression?(node, in_loop = <span class="n">false</span>)</span>
flow_expression?</a>,
<a href="../../../Ameba/AST/Util.html#literal?(node)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#literal%3F%28node%29-instance-method" class="tooltip">
<span>literal?(node)</span>
literal?</a>,
<a href="../../../Ameba/AST/Util.html#loop?(node)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#loop%3F%28node%29-instance-method" class="tooltip">
<span>loop?(node)</span>
loop?</a>,
<a href="../../../Ameba/AST/Util.html#node_source(node,code_lines)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#node_source%28node%2Ccode_lines%29-instance-method" class="tooltip">
<span>node_source(node, code_lines)</span>
node_source</a>,
<a href="../../../Ameba/AST/Util.html#raise?(node)-instance-method" class="tooltip">
<a href="../../../Ameba/AST/Util.html#raise%3F%28node%29-instance-method" class="tooltip">
<span>raise?(node)</span>
raise?</a>
raise?</a>,
<a href="../../../Ameba/AST/Util.html#source_between%28loc%2Cend_loc%2Ccode_lines%29%3AString%3F-instance-method" class="tooltip">
<span>source_between(loc, end_loc, code_lines) : String?</span>
source_between</a>
@ -927,17 +928,17 @@
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -957,12 +958,12 @@
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -1032,7 +1033,7 @@
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -1046,19 +1047,17 @@
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that disallows redundant begin blocks.</p>
<p>Currently it is able to detect:</p>
<ol><li>Exception handler block that can be used as a part of the method.</li></ol>
<ol>
<li>Exception handler block that can be used as a part of the method.</li>
</ol>
<p>For example, this:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
<span class="k">begin</span>
read_content
@ -1066,35 +1065,28 @@
close_file
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>should be rewritten as:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
read_content
<span class="k">rescue</span>
close_file
<span class="k">end</span></code></pre>
<ol><li>begin..end block as a top level block in a method.</li></ol>
<ol start="2">
<li>begin..end block as a top level block in a method.</li>
</ol>
<p>For example this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
<span class="k">begin</span>
a <span class="o">=</span> <span class="n">1</span>
b <span class="o">=</span> <span class="n">2</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>and has to be written as the following:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
a <span class="o">=</span> <span class="n">1</span>
b <span class="o">=</span> <span class="n">2</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/RedundantBegin:
Enabled: true</code></pre>
</div>
@ -1102,7 +1094,7 @@
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_begin.cr#L58" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_begin.cr#L58" target="_blank">View source</a>]
</div>
</div>
@ -1126,7 +1118,7 @@
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1140,7 +1132,7 @@
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1154,7 +1146,7 @@
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1168,7 +1160,7 @@
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1182,7 +1174,7 @@
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1196,7 +1188,7 @@
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1210,7 +1202,7 @@
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1224,7 +1216,7 @@
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1238,13 +1230,13 @@
def <strong>test</strong>(source, node : Crystal::Def)
<a class="method-permalink" href="#test(source,node:Crystal::Def)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_begin.cr#L67" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_begin.cr#L67" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -643,13 +648,10 @@
a block to skip to the next iteration early, however, it is considered
redundant in cases where it is the last expression in a block or combines
into the node which is the last in a block.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
<span class="k">next</span> v <span class="o">+</span> <span class="n">1</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
<span class="k">case</span> v
<span class="k">when</span> .<span class="k">nil?</span>
@ -660,13 +662,10 @@ into the node which is the last in a block.</p>
<span class="k">next</span> <span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>And has to be written as the following:</p>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
v <span class="o">+</span> <span class="n">1</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
<span class="k">case</span> arg
<span class="k">when</span> .<span class="k">nil?</span>
@ -677,51 +676,42 @@ into the node which is the last in a block.</p>
<span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<h3><a id="configuration-params" class="anchor" href="#configuration-params">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Configuration params</h3>
<ol><li><em>allow_multi_next</em>, default: true</li></ol>
<ol>
<li><em>allow_multi_next</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the next statements
which yield tuple literals i.e.</p>
<pre><code class="language-crystal">block <span class="k">do</span>
<span class="k">next</span> a, b
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the block above will be forced to be written as:</p>
<pre><code class="language-crystal">block <span class="k">do</span>
{a, b}
<span class="k">end</span></code></pre>
<ol><li><em>allow_empty_next</em>, default: true</li></ol>
<ol start="2">
<li><em>allow_empty_next</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the next statements
without arguments. Sometimes such statements are used to yild the <code>nil</code> value explicitly.</p>
<pre><code class="language-crystal">block <span class="k">do</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="k">next</span>
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the block above will be forced to be written as:</p>
<pre><code class="language-crystal">block <span class="k">do</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="n">nil</span>
<span class="k">end</span></code></pre>
<h3><a id="yaml-config-example" class="anchor" href="#yaml-config-example">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>YAML config example</h3>
<pre><code class="language-crystal">Style/RedundantNext:
Enabled: true
AllowMultiNext: true
@ -766,7 +756,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_next.cr#L99" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L99" target="_blank">
ameba/rule/style/redundant_next.cr
</a>
@ -807,12 +797,12 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows redundant next expressions.</p></div>
@ -835,72 +825,72 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
<ul class="list-summary">
<li class="entry-summary">
<a href="#allow_empty_next:Bool-instance-method" class="signature"><strong>#allow_empty_next</strong> : Bool</a>
<a href="#allow_empty_next%3ABool-instance-method" class="signature"><strong>#allow_empty_next</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#allow_empty_next=(allow_empty_next:Bool)-instance-method" class="signature"><strong>#allow_empty_next=</strong>(allow_empty_next : Bool)</a>
<a href="#allow_empty_next%3D%28allow_empty_next%3ABool%29-instance-method" class="signature"><strong>#allow_empty_next=</strong>(allow_empty_next : Bool)</a>
</li>
<li class="entry-summary">
<a href="#allow_multi_next:Bool-instance-method" class="signature"><strong>#allow_multi_next</strong> : Bool</a>
<a href="#allow_multi_next%3ABool-instance-method" class="signature"><strong>#allow_multi_next</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#allow_multi_next=(allow_multi_next:Bool)-instance-method" class="signature"><strong>#allow_multi_next=</strong>(allow_multi_next : Bool)</a>
<a href="#allow_multi_next%3D%28allow_multi_next%3ABool%29-instance-method" class="signature"><strong>#allow_multi_next=</strong>(allow_multi_next : Bool)</a>
</li>
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Next, visitor : AST::RedundantControlExpressionVisitor)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ANext%2Cvisitor%3AAST%3A%3ARedundantControlExpressionVisitor%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Next, visitor : AST::RedundantControlExpressionVisitor)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Block)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Block)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ABlock%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Block)</a>
</li>
@ -937,17 +927,17 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -967,12 +957,12 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -1042,7 +1032,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -1056,7 +1046,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
@ -1065,13 +1055,10 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
a block to skip to the next iteration early, however, it is considered
redundant in cases where it is the last expression in a block or combines
into the node which is the last in a block.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
<span class="k">next</span> v <span class="o">+</span> <span class="n">1</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
<span class="k">case</span> v
<span class="k">when</span> .<span class="k">nil?</span>
@ -1082,13 +1069,10 @@ into the node which is the last in a block.</p>
<span class="k">next</span> <span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>And has to be written as the following:</p>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
v <span class="o">+</span> <span class="n">1</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal">block <span class="k">do</span> <span class="o">|</span>v<span class="o">|</span>
<span class="k">case</span> arg
<span class="k">when</span> .<span class="k">nil?</span>
@ -1099,51 +1083,42 @@ into the node which is the last in a block.</p>
<span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<h3><a id="configuration-params" class="anchor" href="#configuration-params">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Configuration params</h3>
<ol><li><em>allow_multi_next</em>, default: true</li></ol>
<ol>
<li><em>allow_multi_next</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the next statements
which yield tuple literals i.e.</p>
<pre><code class="language-crystal">block <span class="k">do</span>
<span class="k">next</span> a, b
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the block above will be forced to be written as:</p>
<pre><code class="language-crystal">block <span class="k">do</span>
{a, b}
<span class="k">end</span></code></pre>
<ol><li><em>allow_empty_next</em>, default: true</li></ol>
<ol start="2">
<li><em>allow_empty_next</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the next statements
without arguments. Sometimes such statements are used to yild the <code>nil</code> value explicitly.</p>
<pre><code class="language-crystal">block <span class="k">do</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="k">next</span>
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the block above will be forced to be written as:</p>
<pre><code class="language-crystal">block <span class="k">do</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="n">nil</span>
<span class="k">end</span></code></pre>
<h3><a id="yaml-config-example" class="anchor" href="#yaml-config-example">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>YAML config example</h3>
<pre><code class="language-crystal">Style/RedundantNext:
Enabled: true
AllowMultiNext: true
@ -1153,7 +1128,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_next.cr#L99" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L99" target="_blank">View source</a>]
</div>
</div>
@ -1177,7 +1152,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>allow_empty_next</strong> : Bool
<a class="method-permalink" href="#allow_empty_next:Bool-instance-method">#</a>
<a class="method-permalink" href="#allow_empty_next%3ABool-instance-method">#</a>
</div>
<br/>
@ -1191,7 +1166,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>allow_empty_next=</strong>(allow_empty_next : Bool)
<a class="method-permalink" href="#allow_empty_next=(allow_empty_next:Bool)-instance-method">#</a>
<a class="method-permalink" href="#allow_empty_next%3D%28allow_empty_next%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1205,7 +1180,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>allow_multi_next</strong> : Bool
<a class="method-permalink" href="#allow_multi_next:Bool-instance-method">#</a>
<a class="method-permalink" href="#allow_multi_next%3ABool-instance-method">#</a>
</div>
<br/>
@ -1219,7 +1194,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>allow_multi_next=</strong>(allow_multi_next : Bool)
<a class="method-permalink" href="#allow_multi_next=(allow_multi_next:Bool)-instance-method">#</a>
<a class="method-permalink" href="#allow_multi_next%3D%28allow_multi_next%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1233,7 +1208,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1247,7 +1222,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1261,7 +1236,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1275,7 +1250,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1289,7 +1264,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1303,7 +1278,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1317,7 +1292,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1331,7 +1306,7 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1345,13 +1320,13 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>test</strong>(source, node : Crystal::Next, visitor : <a href="../../../Ameba/AST/RedundantControlExpressionVisitor.html">AST::RedundantControlExpressionVisitor</a>)
<a class="method-permalink" href="#test(source,node:Crystal::Next,visitor:AST::RedundantControlExpressionVisitor)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ANext%2Cvisitor%3AAST%3A%3ARedundantControlExpressionVisitor%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_next.cr#L113" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L113" target="_blank">View source</a>]
</div>
</div>
@ -1361,13 +1336,13 @@ without arguments. Sometimes such statements are used to yild the <code>nil</cod
def <strong>test</strong>(source, node : Crystal::Block)
<a class="method-permalink" href="#test(source,node:Crystal::Block)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ABlock%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_next.cr#L109" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_next.cr#L109" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,13 +645,10 @@
</h2>
<p>A rule that disallows redundant return expressions.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">foo</span>
<span class="k">return</span> <span class="n">:bar</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">bar</span>(arg)
<span class="k">case</span> arg
<span class="k">when</span> .<span class="k">nil?</span>
@ -657,13 +659,10 @@
<span class="k">return</span> <span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>And has to be written as the following:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">foo</span>
<span class="n">:bar</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">bar</span>(arg)
<span class="k">case</span> arg
<span class="k">when</span> .<span class="k">nil?</span>
@ -674,51 +673,42 @@
<span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<h3><a id="configuration-params" class="anchor" href="#configuration-params">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Configuration params</h3>
<ol><li><em>allow_multi_return</em>, default: true</li></ol>
<ol>
<li><em>allow_multi_return</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the return statements
which return tuple literals i.e.</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>(a, b)
<span class="k">return</span> a, b
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the method above has to be written as:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>(a, b)
{a, b}
<span class="k">end</span></code></pre>
<ol><li><em>allow_empty_return</em>, default: true</li></ol>
<ol start="2">
<li><em>allow_empty_return</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the return statements
without arguments. Sometimes such returns are used to return the <code>nil</code> value explicitly.</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="k">return</span>
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the method above has to be written as:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="n">nil</span>
<span class="k">end</span></code></pre>
<h3><a id="yaml-config-example" class="anchor" href="#yaml-config-example">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>YAML config example</h3>
<pre><code class="language-crystal">Style/RedundantReturn:
Enabled: true
AllowMutliReturn: true
@ -763,7 +753,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_return.cr#L96" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L96" target="_blank">
ameba/rule/style/redundant_return.cr
</a>
@ -804,12 +794,12 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows redundant return expressions.</p></div>
@ -832,72 +822,72 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
<ul class="list-summary">
<li class="entry-summary">
<a href="#allow_empty_return:Bool-instance-method" class="signature"><strong>#allow_empty_return</strong> : Bool</a>
<a href="#allow_empty_return%3ABool-instance-method" class="signature"><strong>#allow_empty_return</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#allow_empty_return=(allow_empty_return:Bool)-instance-method" class="signature"><strong>#allow_empty_return=</strong>(allow_empty_return : Bool)</a>
<a href="#allow_empty_return%3D%28allow_empty_return%3ABool%29-instance-method" class="signature"><strong>#allow_empty_return=</strong>(allow_empty_return : Bool)</a>
</li>
<li class="entry-summary">
<a href="#allow_multi_return:Bool-instance-method" class="signature"><strong>#allow_multi_return</strong> : Bool</a>
<a href="#allow_multi_return%3ABool-instance-method" class="signature"><strong>#allow_multi_return</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#allow_multi_return=(allow_multi_return:Bool)-instance-method" class="signature"><strong>#allow_multi_return=</strong>(allow_multi_return : Bool)</a>
<a href="#allow_multi_return%3D%28allow_multi_return%3ABool%29-instance-method" class="signature"><strong>#allow_multi_return=</strong>(allow_multi_return : Bool)</a>
</li>
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Return, visitor : AST::RedundantControlExpressionVisitor)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AReturn%2Cvisitor%3AAST%3A%3ARedundantControlExpressionVisitor%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Return, visitor : AST::RedundantControlExpressionVisitor)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Def)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Def)</a>
</li>
@ -934,17 +924,17 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -964,12 +954,12 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -1039,7 +1029,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -1053,19 +1043,16 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that disallows redundant return expressions.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">foo</span>
<span class="k">return</span> <span class="n">:bar</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">bar</span>(arg)
<span class="k">case</span> arg
<span class="k">when</span> .<span class="k">nil?</span>
@ -1076,13 +1063,10 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
<span class="k">return</span> <span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<p>And has to be written as the following:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">foo</span>
<span class="n">:bar</span>
<span class="k">end</span></code></pre>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">bar</span>(arg)
<span class="k">case</span> arg
<span class="k">when</span> .<span class="k">nil?</span>
@ -1093,51 +1077,42 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
<span class="s">&quot;empty&quot;</span>
<span class="k">end</span>
<span class="k">end</span></code></pre>
<h3><a id="configuration-params" class="anchor" href="#configuration-params">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>Configuration params</h3>
<ol><li><em>allow_multi_return</em>, default: true</li></ol>
<ol>
<li><em>allow_multi_return</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the return statements
which return tuple literals i.e.</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>(a, b)
<span class="k">return</span> a, b
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the method above has to be written as:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>(a, b)
{a, b}
<span class="k">end</span></code></pre>
<ol><li><em>allow_empty_return</em>, default: true</li></ol>
<ol start="2">
<li><em>allow_empty_return</em>, default: true</li>
</ol>
<p>Allows end-user to configure whether to report or not the return statements
without arguments. Sometimes such returns are used to return the <code>nil</code> value explicitly.</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="k">return</span>
<span class="k">end</span></code></pre>
<p>If this param equals to <code>false</code>, the method above has to be written as:</p>
<pre><code class="language-crystal"><span class="k">def</span> <span class="m">method</span>
@foo <span class="o">=</span> <span class="n">:empty</span>
<span class="n">nil</span>
<span class="k">end</span></code></pre>
<h3><a id="yaml-config-example" class="anchor" href="#yaml-config-example">
<svg class="octicon-link" aria-hidden="true">
<use href="#octicon-link"/>
</svg>
</a>YAML config example</h3>
<pre><code class="language-crystal">Style/RedundantReturn:
Enabled: true
AllowMutliReturn: true
@ -1147,7 +1122,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_return.cr#L96" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L96" target="_blank">View source</a>]
</div>
</div>
@ -1171,7 +1146,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>allow_empty_return</strong> : Bool
<a class="method-permalink" href="#allow_empty_return:Bool-instance-method">#</a>
<a class="method-permalink" href="#allow_empty_return%3ABool-instance-method">#</a>
</div>
<br/>
@ -1185,7 +1160,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>allow_empty_return=</strong>(allow_empty_return : Bool)
<a class="method-permalink" href="#allow_empty_return=(allow_empty_return:Bool)-instance-method">#</a>
<a class="method-permalink" href="#allow_empty_return%3D%28allow_empty_return%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1199,7 +1174,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>allow_multi_return</strong> : Bool
<a class="method-permalink" href="#allow_multi_return:Bool-instance-method">#</a>
<a class="method-permalink" href="#allow_multi_return%3ABool-instance-method">#</a>
</div>
<br/>
@ -1213,7 +1188,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>allow_multi_return=</strong>(allow_multi_return : Bool)
<a class="method-permalink" href="#allow_multi_return=(allow_multi_return:Bool)-instance-method">#</a>
<a class="method-permalink" href="#allow_multi_return%3D%28allow_multi_return%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1227,7 +1202,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1241,7 +1216,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1255,7 +1230,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1269,7 +1244,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1283,7 +1258,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1297,7 +1272,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1311,7 +1286,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1325,7 +1300,7 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1339,13 +1314,13 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>test</strong>(source, node : Crystal::Return, visitor : <a href="../../../Ameba/AST/RedundantControlExpressionVisitor.html">AST::RedundantControlExpressionVisitor</a>)
<a class="method-permalink" href="#test(source,node:Crystal::Return,visitor:AST::RedundantControlExpressionVisitor)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AReturn%2Cvisitor%3AAST%3A%3ARedundantControlExpressionVisitor%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_return.cr#L110" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L110" target="_blank">View source</a>]
</div>
</div>
@ -1355,13 +1330,13 @@ without arguments. Sometimes such returns are used to return the <code>nil</code
def <strong>test</strong>(source, node : Crystal::Def)
<a class="method-permalink" href="#test(source,node:Crystal::Def)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ADef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/redundant_return.cr#L106" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/redundant_return.cr#L106" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,9 +645,7 @@
</h2>
<p>A rule that enforces type names in camelcase manner.</p>
<p>For example, these are considered valid:</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">ParseError</span> <span class="o">&lt;</span> <span class="t">Exception</span>
<span class="k">end</span>
@ -661,9 +664,7 @@
<span class="k">enum</span> <span class="t">Time</span><span class="t">::</span><span class="t">DayOfWeek</span>
<span class="k">end</span></code></pre>
<p>And these are invalid type names</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">My_class</span>
<span class="k">end</span>
@ -680,9 +681,7 @@
<span class="k">enum</span> <span class="t">Time_enum</span><span class="t">::</span><span class="t">Day_of_week</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/TypeNames:
Enabled: true</code></pre>
@ -725,7 +724,7 @@
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/type_names.cr#L54" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L54" target="_blank">
ameba/rule/style/type_names.cr
</a>
@ -766,12 +765,12 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that enforces type names in camelcase manner.</p></div>
@ -794,67 +793,67 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::ClassDef)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::ClassDef)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AClassDef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::ClassDef)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Alias)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Alias)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AAlias%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Alias)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::LibDef)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::LibDef)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ALibDef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::LibDef)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::EnumDef)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::EnumDef)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AEnumDef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::EnumDef)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::ModuleDef)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::ModuleDef)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AModuleDef%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::ModuleDef)</a>
</li>
@ -891,17 +890,17 @@
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -921,12 +920,12 @@
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -996,7 +995,7 @@
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -1010,15 +1009,13 @@
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that enforces type names in camelcase manner.</p>
<p>For example, these are considered valid:</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">ParseError</span> <span class="o">&lt;</span> <span class="t">Exception</span>
<span class="k">end</span>
@ -1037,9 +1034,7 @@
<span class="k">enum</span> <span class="t">Time</span><span class="t">::</span><span class="t">DayOfWeek</span>
<span class="k">end</span></code></pre>
<p>And these are invalid type names</p>
<pre><code class="language-crystal"><span class="k">class</span> <span class="t">My_class</span>
<span class="k">end</span>
@ -1056,9 +1051,7 @@
<span class="k">enum</span> <span class="t">Time_enum</span><span class="t">::</span><span class="t">Day_of_week</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/TypeNames:
Enabled: true</code></pre>
</div>
@ -1066,7 +1059,7 @@
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/type_names.cr#L54" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L54" target="_blank">View source</a>]
</div>
</div>
@ -1090,7 +1083,7 @@
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1104,7 +1097,7 @@
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1118,7 +1111,7 @@
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1132,7 +1125,7 @@
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1146,7 +1139,7 @@
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1160,7 +1153,7 @@
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1174,7 +1167,7 @@
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1188,7 +1181,7 @@
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1202,13 +1195,13 @@
def <strong>test</strong>(source, node : Crystal::ClassDef)
<a class="method-permalink" href="#test(source,node:Crystal::ClassDef)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AClassDef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/type_names.cr#L69" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L69" target="_blank">View source</a>]
</div>
</div>
@ -1218,13 +1211,13 @@
def <strong>test</strong>(source, node : Crystal::Alias)
<a class="method-permalink" href="#test(source,node:Crystal::Alias)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AAlias%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/type_names.cr#L73" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L73" target="_blank">View source</a>]
</div>
</div>
@ -1234,13 +1227,13 @@
def <strong>test</strong>(source, node : Crystal::LibDef)
<a class="method-permalink" href="#test(source,node:Crystal::LibDef)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ALibDef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/type_names.cr#L77" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L77" target="_blank">View source</a>]
</div>
</div>
@ -1250,13 +1243,13 @@
def <strong>test</strong>(source, node : Crystal::EnumDef)
<a class="method-permalink" href="#test(source,node:Crystal::EnumDef)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AEnumDef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/type_names.cr#L81" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L81" target="_blank">View source</a>]
</div>
</div>
@ -1266,13 +1259,13 @@
def <strong>test</strong>(source, node : Crystal::ModuleDef)
<a class="method-permalink" href="#test(source,node:Crystal::ModuleDef)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AModuleDef%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/type_names.cr#L85" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/type_names.cr#L85" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,9 +645,7 @@
</h2>
<p>A rule that disallows the use of an <code>else</code> block with the <code>unless</code>.</p>
<p>For example, the rule considers these valid:</p>
<pre><code class="language-crystal"><span class="k">unless</span> something
<span class="n">:ok</span>
<span class="k">end</span>
@ -652,26 +655,20 @@
<span class="k">else</span>
<span class="n">:two</span>
<span class="k">end</span></code></pre>
<p>But it considers this one invalid as it is an <code>unless</code> with an <code>else</code>:</p>
<pre><code class="language-crystal"><span class="k">unless</span> something
<span class="n">:one</span>
<span class="k">else</span>
<span class="n">:two</span>
<span class="k">end</span></code></pre>
<p>The solution is to swap the order of the blocks, and change the <code>unless</code> to
an <code>if</code>, so the previous invalid example would become this:</p>
<pre><code class="language-crystal"><span class="k">if</span> something
<span class="n">:two</span>
<span class="k">else</span>
<span class="n">:one</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/UnlessElse:
Enabled: true</code></pre>
@ -714,7 +711,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/unless_else.cr#L45" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/unless_else.cr#L45" target="_blank">
ameba/rule/style/unless_else.cr
</a>
@ -755,12 +752,12 @@ an <code>if</code>, so the previous invalid example would become this:</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows the use of an <code>else</code> block with the <code>unless</code>.</p></div>
@ -783,47 +780,47 @@ an <code>if</code>, so the previous invalid example would become this:</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Unless)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Unless)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AUnless%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Unless)</a>
</li>
@ -860,17 +857,17 @@ an <code>if</code>, so the previous invalid example would become this:</p>
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -890,12 +887,12 @@ an <code>if</code>, so the previous invalid example would become this:</p>
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -965,7 +962,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -979,15 +976,13 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that disallows the use of an <code>else</code> block with the <code>unless</code>.</p>
<p>For example, the rule considers these valid:</p>
<pre><code class="language-crystal"><span class="k">unless</span> something
<span class="n">:ok</span>
<span class="k">end</span>
@ -997,26 +992,20 @@ an <code>if</code>, so the previous invalid example would become this:</p>
<span class="k">else</span>
<span class="n">:two</span>
<span class="k">end</span></code></pre>
<p>But it considers this one invalid as it is an <code>unless</code> with an <code>else</code>:</p>
<pre><code class="language-crystal"><span class="k">unless</span> something
<span class="n">:one</span>
<span class="k">else</span>
<span class="n">:two</span>
<span class="k">end</span></code></pre>
<p>The solution is to swap the order of the blocks, and change the <code>unless</code> to
an <code>if</code>, so the previous invalid example would become this:</p>
<pre><code class="language-crystal"><span class="k">if</span> something
<span class="n">:two</span>
<span class="k">else</span>
<span class="n">:one</span>
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/UnlessElse:
Enabled: true</code></pre>
</div>
@ -1024,7 +1013,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/unless_else.cr#L45" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/unless_else.cr#L45" target="_blank">View source</a>]
</div>
</div>
@ -1048,7 +1037,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1062,7 +1051,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1076,7 +1065,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1090,7 +1079,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1104,7 +1093,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1118,7 +1107,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1132,7 +1121,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1146,7 +1135,7 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1160,13 +1149,13 @@ an <code>if</code>, so the previous invalid example would become this:</p>
def <strong>test</strong>(source, node : Crystal::Unless)
<a class="method-permalink" href="#test(source,node:Crystal::Unless)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AUnless%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/unless_else.cr#L52" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/unless_else.cr#L52" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,20 +645,14 @@
</h2>
<p>A rule that enforces variable names to be in underscored case.</p>
<p>For example, these variable names are considered valid:</p>
<pre><code class="language-crystal">var_name <span class="o">=</span> <span class="n">1</span>
name <span class="o">=</span> <span class="n">2</span>
_another_good_name <span class="o">=</span> <span class="n">3</span></code></pre>
<p>And these are invalid variable names:</p>
<pre><code class="language-crystal">myBadNamedVar <span class="o">=</span> <span class="n">1</span>
wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/VariableNames:
Enabled: true</code></pre>
@ -696,7 +695,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/variable_names.cr#L25" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L25" target="_blank">
ameba/rule/style/variable_names.cr
</a>
@ -737,12 +736,12 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that enforces variable names to be in underscored case.</p></div>
@ -765,57 +764,57 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Var)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Var)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AVar%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Var)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::InstanceVar)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::InstanceVar)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AInstanceVar%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::InstanceVar)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::ClassVar)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::ClassVar)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AClassVar%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::ClassVar)</a>
</li>
@ -852,17 +851,17 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -882,12 +881,12 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -957,7 +956,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -971,26 +970,20 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that enforces variable names to be in underscored case.</p>
<p>For example, these variable names are considered valid:</p>
<pre><code class="language-crystal">var_name <span class="o">=</span> <span class="n">1</span>
name <span class="o">=</span> <span class="n">2</span>
_another_good_name <span class="o">=</span> <span class="n">3</span></code></pre>
<p>And these are invalid variable names:</p>
<pre><code class="language-crystal">myBadNamedVar <span class="o">=</span> <span class="n">1</span>
wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/VariableNames:
Enabled: true</code></pre>
</div>
@ -998,7 +991,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/variable_names.cr#L25" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L25" target="_blank">View source</a>]
</div>
</div>
@ -1022,7 +1015,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1036,7 +1029,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1050,7 +1043,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1064,7 +1057,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1078,7 +1071,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1092,7 +1085,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1106,7 +1099,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1120,7 +1113,7 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1134,13 +1127,13 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>test</strong>(source, node : Crystal::Var)
<a class="method-permalink" href="#test(source,node:Crystal::Var)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AVar%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/variable_names.cr#L38" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L38" target="_blank">View source</a>]
</div>
</div>
@ -1150,13 +1143,13 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>test</strong>(source, node : Crystal::InstanceVar)
<a class="method-permalink" href="#test(source,node:Crystal::InstanceVar)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AInstanceVar%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/variable_names.cr#L42" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L42" target="_blank">View source</a>]
</div>
</div>
@ -1166,13 +1159,13 @@ wrong_Name <span class="o">=</span> <span class="n">2</span></code></pre>
def <strong>test</strong>(source, node : Crystal::ClassVar)
<a class="method-permalink" href="#test(source,node:Crystal::ClassVar)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AClassVar%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/variable_names.cr#L46" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/variable_names.cr#L46" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -641,17 +646,11 @@
<p>This rule is used to identify usage of single expression blocks with
argument as a receiver, that can be collapsed into a short form.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal">(<span class="n">1</span>..<span class="n">3</span>).any? { <span class="o">|</span>i<span class="o">|</span> i.odd? }</code></pre>
<p>And it should be written as this:</p>
<pre><code class="language-crystal">(<span class="n">1</span>..<span class="n">3</span>).any?(<span class="o">&amp;</span>.odd?)</code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/VerboseBlock:
Enabled: true
ExcludeMultipleLineBlocks: true
@ -701,7 +700,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/verbose_block.cr#L30" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L30" target="_blank">
ameba/rule/style/verbose_block.cr
</a>
@ -747,12 +746,12 @@ argument as a receiver, that can be collapsed into a short form.</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>This rule is used to identify usage of single expression blocks with argument as a receiver, that can be collapsed into a short form.</p></div>
@ -775,117 +774,117 @@ argument as a receiver, that can be collapsed into a short form.</p>
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#exclude_calls_with_block:Bool-instance-method" class="signature"><strong>#exclude_calls_with_block</strong> : Bool</a>
<a href="#exclude_calls_with_block%3ABool-instance-method" class="signature"><strong>#exclude_calls_with_block</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method" class="signature"><strong>#exclude_calls_with_block=</strong>(exclude_calls_with_block : Bool)</a>
<a href="#exclude_calls_with_block%3D%28exclude_calls_with_block%3ABool%29-instance-method" class="signature"><strong>#exclude_calls_with_block=</strong>(exclude_calls_with_block : Bool)</a>
</li>
<li class="entry-summary">
<a href="#exclude_multiple_line_blocks:Bool-instance-method" class="signature"><strong>#exclude_multiple_line_blocks</strong> : Bool</a>
<a href="#exclude_multiple_line_blocks%3ABool-instance-method" class="signature"><strong>#exclude_multiple_line_blocks</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method" class="signature"><strong>#exclude_multiple_line_blocks=</strong>(exclude_multiple_line_blocks : Bool)</a>
<a href="#exclude_multiple_line_blocks%3D%28exclude_multiple_line_blocks%3ABool%29-instance-method" class="signature"><strong>#exclude_multiple_line_blocks=</strong>(exclude_multiple_line_blocks : Bool)</a>
</li>
<li class="entry-summary">
<a href="#exclude_operators:Bool-instance-method" class="signature"><strong>#exclude_operators</strong> : Bool</a>
<a href="#exclude_operators%3ABool-instance-method" class="signature"><strong>#exclude_operators</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#exclude_operators=(exclude_operators:Bool)-instance-method" class="signature"><strong>#exclude_operators=</strong>(exclude_operators : Bool)</a>
<a href="#exclude_operators%3D%28exclude_operators%3ABool%29-instance-method" class="signature"><strong>#exclude_operators=</strong>(exclude_operators : Bool)</a>
</li>
<li class="entry-summary">
<a href="#exclude_prefix_operators:Bool-instance-method" class="signature"><strong>#exclude_prefix_operators</strong> : Bool</a>
<a href="#exclude_prefix_operators%3ABool-instance-method" class="signature"><strong>#exclude_prefix_operators</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method" class="signature"><strong>#exclude_prefix_operators=</strong>(exclude_prefix_operators : Bool)</a>
<a href="#exclude_prefix_operators%3D%28exclude_prefix_operators%3ABool%29-instance-method" class="signature"><strong>#exclude_prefix_operators=</strong>(exclude_prefix_operators : Bool)</a>
</li>
<li class="entry-summary">
<a href="#exclude_setters:Bool-instance-method" class="signature"><strong>#exclude_setters</strong> : Bool</a>
<a href="#exclude_setters%3ABool-instance-method" class="signature"><strong>#exclude_setters</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#exclude_setters=(exclude_setters:Bool)-instance-method" class="signature"><strong>#exclude_setters=</strong>(exclude_setters : Bool)</a>
<a href="#exclude_setters%3D%28exclude_setters%3ABool%29-instance-method" class="signature"><strong>#exclude_setters=</strong>(exclude_setters : Bool)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#max_length:Int32?-instance-method" class="signature"><strong>#max_length</strong> : Int32?</a>
<a href="#max_length%3AInt32%3F-instance-method" class="signature"><strong>#max_length</strong> : Int32?</a>
</li>
<li class="entry-summary">
<a href="#max_length=(max_length:Int32?)-instance-method" class="signature"><strong>#max_length=</strong>(max_length : Int32?)</a>
<a href="#max_length%3D%28max_length%3AInt32%3F%29-instance-method" class="signature"><strong>#max_length=</strong>(max_length : Int32?)</a>
</li>
<li class="entry-summary">
<a href="#max_line_length:Int32?-instance-method" class="signature"><strong>#max_line_length</strong> : Int32?</a>
<a href="#max_line_length%3AInt32%3F-instance-method" class="signature"><strong>#max_line_length</strong> : Int32?</a>
</li>
<li class="entry-summary">
<a href="#max_line_length=(max_line_length:Int32?)-instance-method" class="signature"><strong>#max_line_length=</strong>(max_line_length : Int32?)</a>
<a href="#max_line_length%3D%28max_line_length%3AInt32%3F%29-instance-method" class="signature"><strong>#max_line_length=</strong>(max_line_length : Int32?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::Call)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Call)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3ACall%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::Call)</a>
</li>
@ -922,17 +921,17 @@ argument as a receiver, that can be collapsed into a short form.</p>
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -952,12 +951,12 @@ argument as a receiver, that can be collapsed into a short form.</p>
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -1027,7 +1026,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -1041,24 +1040,18 @@ argument as a receiver, that can be collapsed into a short form.</p>
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>This rule is used to identify usage of single expression blocks with
argument as a receiver, that can be collapsed into a short form.</p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal">(<span class="n">1</span>..<span class="n">3</span>).any? { <span class="o">|</span>i<span class="o">|</span> i.odd? }</code></pre>
<p>And it should be written as this:</p>
<pre><code class="language-crystal">(<span class="n">1</span>..<span class="n">3</span>).any?(<span class="o">&amp;</span>.odd?)</code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/VerboseBlock:
Enabled: true
ExcludeMultipleLineBlocks: true
@ -1073,7 +1066,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/verbose_block.cr#L30" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L30" target="_blank">View source</a>]
</div>
</div>
@ -1097,7 +1090,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1111,7 +1104,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1125,7 +1118,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1139,7 +1132,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1153,7 +1146,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_calls_with_block</strong> : Bool
<a class="method-permalink" href="#exclude_calls_with_block:Bool-instance-method">#</a>
<a class="method-permalink" href="#exclude_calls_with_block%3ABool-instance-method">#</a>
</div>
<br/>
@ -1167,7 +1160,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_calls_with_block=</strong>(exclude_calls_with_block : Bool)
<a class="method-permalink" href="#exclude_calls_with_block=(exclude_calls_with_block:Bool)-instance-method">#</a>
<a class="method-permalink" href="#exclude_calls_with_block%3D%28exclude_calls_with_block%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1181,7 +1174,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_multiple_line_blocks</strong> : Bool
<a class="method-permalink" href="#exclude_multiple_line_blocks:Bool-instance-method">#</a>
<a class="method-permalink" href="#exclude_multiple_line_blocks%3ABool-instance-method">#</a>
</div>
<br/>
@ -1195,7 +1188,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_multiple_line_blocks=</strong>(exclude_multiple_line_blocks : Bool)
<a class="method-permalink" href="#exclude_multiple_line_blocks=(exclude_multiple_line_blocks:Bool)-instance-method">#</a>
<a class="method-permalink" href="#exclude_multiple_line_blocks%3D%28exclude_multiple_line_blocks%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1209,7 +1202,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_operators</strong> : Bool
<a class="method-permalink" href="#exclude_operators:Bool-instance-method">#</a>
<a class="method-permalink" href="#exclude_operators%3ABool-instance-method">#</a>
</div>
<br/>
@ -1223,7 +1216,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_operators=</strong>(exclude_operators : Bool)
<a class="method-permalink" href="#exclude_operators=(exclude_operators:Bool)-instance-method">#</a>
<a class="method-permalink" href="#exclude_operators%3D%28exclude_operators%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1237,7 +1230,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_prefix_operators</strong> : Bool
<a class="method-permalink" href="#exclude_prefix_operators:Bool-instance-method">#</a>
<a class="method-permalink" href="#exclude_prefix_operators%3ABool-instance-method">#</a>
</div>
<br/>
@ -1251,7 +1244,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_prefix_operators=</strong>(exclude_prefix_operators : Bool)
<a class="method-permalink" href="#exclude_prefix_operators=(exclude_prefix_operators:Bool)-instance-method">#</a>
<a class="method-permalink" href="#exclude_prefix_operators%3D%28exclude_prefix_operators%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1265,7 +1258,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_setters</strong> : Bool
<a class="method-permalink" href="#exclude_setters:Bool-instance-method">#</a>
<a class="method-permalink" href="#exclude_setters%3ABool-instance-method">#</a>
</div>
<br/>
@ -1279,7 +1272,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>exclude_setters=</strong>(exclude_setters : Bool)
<a class="method-permalink" href="#exclude_setters=(exclude_setters:Bool)-instance-method">#</a>
<a class="method-permalink" href="#exclude_setters%3D%28exclude_setters%3ABool%29-instance-method">#</a>
</div>
<br/>
@ -1293,7 +1286,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1307,7 +1300,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1321,7 +1314,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>max_length</strong> : Int32?
<a class="method-permalink" href="#max_length:Int32?-instance-method">#</a>
<a class="method-permalink" href="#max_length%3AInt32%3F-instance-method">#</a>
</div>
<br/>
@ -1335,7 +1328,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>max_length=</strong>(max_length : Int32?)
<a class="method-permalink" href="#max_length=(max_length:Int32?)-instance-method">#</a>
<a class="method-permalink" href="#max_length%3D%28max_length%3AInt32%3F%29-instance-method">#</a>
</div>
<br/>
@ -1349,7 +1342,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>max_line_length</strong> : Int32?
<a class="method-permalink" href="#max_line_length:Int32?-instance-method">#</a>
<a class="method-permalink" href="#max_line_length%3AInt32%3F-instance-method">#</a>
</div>
<br/>
@ -1363,7 +1356,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>max_line_length=</strong>(max_line_length : Int32?)
<a class="method-permalink" href="#max_line_length=(max_line_length:Int32?)-instance-method">#</a>
<a class="method-permalink" href="#max_line_length%3D%28max_line_length%3AInt32%3F%29-instance-method">#</a>
</div>
<br/>
@ -1377,7 +1370,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1391,7 +1384,7 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1405,13 +1398,13 @@ argument as a receiver, that can be collapsed into a short form.</p>
def <strong>test</strong>(source, node : Crystal::Call)
<a class="method-permalink" href="#test(source,node:Crystal::Call)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3ACall%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/verbose_block.cr#L189" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/verbose_block.cr#L189" target="_blank">View source</a>]
</div>
</div>

View file

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="Crystal Docs 0.36.1">
<meta name="generator" content="Crystal Docs 1.1.1">
<meta name="crystal_docs.project_version" content="master">
<meta name="crystal_docs.project_name" content="ameba">
@ -286,6 +286,11 @@
<ul>
<li class=" " data-id="ameba/Ameba/Rule/Lint/AmbiguousAssignment" data-name="ameba::rule::lint::ambiguousassignment">
<a href="../../../Ameba/Rule/Lint/AmbiguousAssignment.html">AmbiguousAssignment</a>
</li>
<li class=" " data-id="ameba/Ameba/Rule/Lint/BadDirective" data-name="ameba::rule::lint::baddirective">
<a href="../../../Ameba/Rule/Lint/BadDirective.html">BadDirective</a>
@ -640,23 +645,17 @@
</h2>
<p>A rule that disallows the use of <code>while true</code> instead of using the idiomatic <code>loop</code></p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">while</span> <span class="n">true</span>
do_something
<span class="k">break</span> <span class="k">if</span> some_condition
<span class="k">end</span></code></pre>
<p>And should be replaced by the following:</p>
<pre><code class="language-crystal">loop <span class="k">do</span>
do_something
<span class="k">break</span> <span class="k">if</span> some_condition
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/WhileTrue:
Enabled: true</code></pre>
@ -699,7 +698,7 @@
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/while_true.cr#L28" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/while_true.cr#L28" target="_blank">
ameba/rule/style/while_true.cr
</a>
@ -740,12 +739,12 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
<a href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method" class="signature"><strong>.new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)</a>
</li>
<li class="entry-summary">
<a href="#new(config=nil)-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<a href="#new%28config%3Dnil%29-class-method" class="signature"><strong>.new</strong>(config = <span class="n">nil</span>)</a>
<div class="summary"><p>A rule that disallows the use of <code>while true</code> instead of using the idiomatic <code>loop</code></p></div>
@ -768,47 +767,47 @@
<ul class="list-summary">
<li class="entry-summary">
<a href="#description:String-instance-method" class="signature"><strong>#description</strong> : String</a>
<a href="#description%3AString-instance-method" class="signature"><strong>#description</strong> : String</a>
</li>
<li class="entry-summary">
<a href="#description=(description:String)-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
<a href="#description%3D%28description%3AString%29-instance-method" class="signature"><strong>#description=</strong>(description : String)</a>
</li>
<li class="entry-summary">
<a href="#enabled:Bool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
<a href="#enabled%3ABool-instance-method" class="signature"><strong>#enabled</strong> : Bool</a>
</li>
<li class="entry-summary">
<a href="#enabled=(enabled)-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
<a href="#enabled%3D%28enabled%29-instance-method" class="signature"><strong>#enabled=</strong>(enabled)</a>
</li>
<li class="entry-summary">
<a href="#excluded:Array(String)?-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
<a href="#excluded%3AArray%28String%29%3F-instance-method" class="signature"><strong>#excluded</strong> : Array(String)?</a>
</li>
<li class="entry-summary">
<a href="#excluded=(excluded:Array(String)?)-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
<a href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method" class="signature"><strong>#excluded=</strong>(excluded : Array(String)?)</a>
</li>
<li class="entry-summary">
<a href="#severity:Ameba::Severity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
<a href="#severity%3AAmeba%3A%3ASeverity-instance-method" class="signature"><strong>#severity</strong> : Ameba::Severity</a>
</li>
<li class="entry-summary">
<a href="#severity=(severity)-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
<a href="#severity%3D%28severity%29-instance-method" class="signature"><strong>#severity=</strong>(severity)</a>
</li>
<li class="entry-summary">
<a href="#test(source,node:Crystal::While)-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::While)</a>
<a href="#test%28source%2Cnode%3ACrystal%3A%3AWhile%29-instance-method" class="signature"><strong>#test</strong>(source, node : Crystal::While)</a>
</li>
@ -845,17 +844,17 @@
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></code></h3>
<a href="../../../Ameba/Rule/Base.html#==(other)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#%3D%3D%28other%29-instance-method" class="tooltip">
<span>==(other)</span>
==</a>,
<a href="../../../Ameba/Rule/Base.html#catch(source:Source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#catch%28source%3ASource%29-instance-method" class="tooltip">
<span>catch(source : Source)</span>
catch</a>,
<a href="../../../Ameba/Rule/Base.html#excluded?(source)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#excluded%3F%28source%29-instance-method" class="tooltip">
<span>excluded?(source)</span>
excluded?</a>,
@ -875,12 +874,12 @@
name</a>,
<a href="../../../Ameba/Rule/Base.html#special?-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#special%3F-instance-method" class="tooltip">
<span>special?</span>
special?</a>,
<a href="../../../Ameba/Rule/Base.html#test(source:Source,node:Crystal::ASTNode,*opts)-instance-method" class="tooltip">
<a href="../../../Ameba/Rule/Base.html#test%28source%3ASource%2Cnode%3ACrystal%3A%3AASTNode%2C%2Aopts%29-instance-method" class="tooltip">
<span>test(source : Source, node : Crystal::ASTNode, *opts)<br/>test(source : Source)</span>
test</a>
@ -950,7 +949,7 @@
def self.<strong>new</strong>(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
<a class="method-permalink" href="#new%28ctx%3AYAML%3A%3AParseContext%2Cnode%3AYAML%3A%3ANodes%3A%3ANode%29-class-method">#</a>
</div>
<br/>
@ -964,29 +963,23 @@
def self.<strong>new</strong>(config = <span class="n">nil</span>)
<a class="method-permalink" href="#new(config=nil)-class-method">#</a>
<a class="method-permalink" href="#new%28config%3Dnil%29-class-method">#</a>
</div>
<div class="doc">
<p>A rule that disallows the use of <code>while true</code> instead of using the idiomatic <code>loop</code></p>
<p>For example, this is considered invalid:</p>
<pre><code class="language-crystal"><span class="k">while</span> <span class="n">true</span>
do_something
<span class="k">break</span> <span class="k">if</span> some_condition
<span class="k">end</span></code></pre>
<p>And should be replaced by the following:</p>
<pre><code class="language-crystal">loop <span class="k">do</span>
do_something
<span class="k">break</span> <span class="k">if</span> some_condition
<span class="k">end</span></code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal">Style/WhileTrue:
Enabled: true</code></pre>
</div>
@ -994,7 +987,7 @@
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/while_true.cr#L28" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/while_true.cr#L28" target="_blank">View source</a>]
</div>
</div>
@ -1018,7 +1011,7 @@
def <strong>description</strong> : String
<a class="method-permalink" href="#description:String-instance-method">#</a>
<a class="method-permalink" href="#description%3AString-instance-method">#</a>
</div>
<br/>
@ -1032,7 +1025,7 @@
def <strong>description=</strong>(description : String)
<a class="method-permalink" href="#description=(description:String)-instance-method">#</a>
<a class="method-permalink" href="#description%3D%28description%3AString%29-instance-method">#</a>
</div>
<br/>
@ -1046,7 +1039,7 @@
def <strong>enabled</strong> : Bool
<a class="method-permalink" href="#enabled:Bool-instance-method">#</a>
<a class="method-permalink" href="#enabled%3ABool-instance-method">#</a>
</div>
<br/>
@ -1060,7 +1053,7 @@
def <strong>enabled=</strong>(enabled)
<a class="method-permalink" href="#enabled=(enabled)-instance-method">#</a>
<a class="method-permalink" href="#enabled%3D%28enabled%29-instance-method">#</a>
</div>
<br/>
@ -1074,7 +1067,7 @@
def <strong>excluded</strong> : Array(String)?
<a class="method-permalink" href="#excluded:Array(String)?-instance-method">#</a>
<a class="method-permalink" href="#excluded%3AArray%28String%29%3F-instance-method">#</a>
</div>
<br/>
@ -1088,7 +1081,7 @@
def <strong>excluded=</strong>(excluded : Array(String)?)
<a class="method-permalink" href="#excluded=(excluded:Array(String)?)-instance-method">#</a>
<a class="method-permalink" href="#excluded%3D%28excluded%3AArray%28String%29%3F%29-instance-method">#</a>
</div>
<br/>
@ -1102,7 +1095,7 @@
def <strong>severity</strong> : <a href="../../../Ameba/Severity.html">Ameba::Severity</a>
<a class="method-permalink" href="#severity:Ameba::Severity-instance-method">#</a>
<a class="method-permalink" href="#severity%3AAmeba%3A%3ASeverity-instance-method">#</a>
</div>
<br/>
@ -1116,7 +1109,7 @@
def <strong>severity=</strong>(severity)
<a class="method-permalink" href="#severity=(severity)-instance-method">#</a>
<a class="method-permalink" href="#severity%3D%28severity%29-instance-method">#</a>
</div>
<br/>
@ -1130,13 +1123,13 @@
def <strong>test</strong>(source, node : Crystal::While)
<a class="method-permalink" href="#test(source,node:Crystal::While)-instance-method">#</a>
<a class="method-permalink" href="#test%28source%2Cnode%3ACrystal%3A%3AWhile%29-instance-method">#</a>
</div>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/9a91e42b/src/ameba/rule/style/while_true.cr#L35" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/48b15b9b/src/ameba/rule/style/while_true.cr#L35" target="_blank">View source</a>]
</div>
</div>