mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Deploying to gh-pages from @ cd18c6a000
🚀
This commit is contained in:
parent
8b14685ad7
commit
b143fb0a6d
104 changed files with 2691 additions and 622 deletions
|
@ -451,6 +451,11 @@
|
|||
|
||||
</li>
|
||||
|
||||
<li class=" " data-id="ameba/Ameba/Rule/Performance/Base" data-name="ameba::rule::performance::base">
|
||||
<a href="../../../Ameba/Rule/Performance/Base.html">Base</a>
|
||||
|
||||
</li>
|
||||
|
||||
<li class=" current" data-id="ameba/Ameba/Rule/Performance/ChainedCallWithNoBang" data-name="ameba::rule::performance::chainedcallwithnobang">
|
||||
<a href="../../../Ameba/Rule/Performance/ChainedCallWithNoBang.html">ChainedCallWithNoBang</a>
|
||||
|
||||
|
@ -620,7 +625,7 @@
|
|||
</h1>
|
||||
|
||||
|
||||
<ul class="superclass-hierarchy"><li class="superclass"><a href="../../../Ameba/Rule/Performance/ChainedCallWithNoBang.html">Ameba::Rule::Performance::ChainedCallWithNoBang</a></li><li class="superclass"><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
|
||||
<ul class="superclass-hierarchy"><li class="superclass"><a href="../../../Ameba/Rule/Performance/ChainedCallWithNoBang.html">Ameba::Rule::Performance::ChainedCallWithNoBang</a></li><li class="superclass"><a href="../../../Ameba/Rule/Performance/Base.html">Ameba::Rule::Performance::Base</a></li><li class="superclass"><a href="../../../Ameba/Rule/Base.html">Ameba::Rule::Base</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul>
|
||||
|
||||
|
||||
|
||||
|
@ -703,7 +708,7 @@ chars <span class="o">=</span> names
|
|||
</h2>
|
||||
|
||||
|
||||
<a href="https://github.com/crystal-ameba/ameba/blob/7c586eb9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L37" target="_blank">
|
||||
<a href="https://github.com/crystal-ameba/ameba/blob/cd18c6a0/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39" target="_blank">
|
||||
ameba/rule/performance/chained_call_with_no_bang.cr
|
||||
</a>
|
||||
|
||||
|
@ -755,6 +760,8 @@ chars <span class="o">=</span> names
|
|||
<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>
|
||||
|
||||
<div class="summary"><p>This rule is used to identify usage of chained calls not utilizing the bang method variants.</p></div>
|
||||
|
||||
</li>
|
||||
|
||||
<li class="entry-summary">
|
||||
|
@ -860,6 +867,54 @@ chars <span class="o">=</span> names
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Instance methods inherited from class <code><a href="../../../Ameba/Rule/Performance/Base.html">Ameba::Rule::Performance::Base</a></code></h3>
|
||||
|
||||
|
||||
<a href="../../../Ameba/Rule/Performance/Base.html#catch(source:Source)-instance-method" class="tooltip">
|
||||
<span>catch(source : Source)</span>
|
||||
catch</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Constructor methods inherited from class <code><a href="../../../Ameba/Rule/Performance/Base.html">Ameba::Rule::Performance::Base</a></code></h3>
|
||||
|
||||
|
||||
<a href="../../../Ameba/Rule/Performance/Base.html#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method" class="tooltip">
|
||||
<span>new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)<br/>new(config = <span class="n">nil</span>)</span>
|
||||
new</a>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -981,6 +1036,39 @@ chars <span class="o">=</span> names
|
|||
<a class="method-permalink" href="#new(ctx:YAML::ParseContext,node:YAML::Nodes::Node)-class-method">#</a>
|
||||
</div>
|
||||
|
||||
<div class="doc">
|
||||
|
||||
<p>This rule is used to identify usage of chained calls not utilizing
|
||||
the bang method variants.</p>
|
||||
|
||||
<p>For example, this is considered inefficient:</p>
|
||||
|
||||
<pre><code class="language-crystal">names <span class="o">=</span> <span class="s">%w[Alice Bob]</span>
|
||||
chars <span class="o">=</span> names
|
||||
.flat_map(<span class="o">&</span>.chars)
|
||||
.uniq
|
||||
.sort</code></pre>
|
||||
|
||||
<p>And can be written as this:</p>
|
||||
|
||||
<pre><code class="language-crystal">names <span class="o">=</span> <span class="s">%w[Alice Bob]</span>
|
||||
chars <span class="o">=</span> names
|
||||
.flat_map(<span class="o">&</span>.chars)
|
||||
.uniq!
|
||||
.sort!</code></pre>
|
||||
|
||||
<p>YAML configuration example:</p>
|
||||
|
||||
<pre><code class="language-crystal">Performance/ChainedCallWithNoBang:
|
||||
Enabled: true
|
||||
CallNames:
|
||||
- uniq
|
||||
- sort
|
||||
- sort_by
|
||||
- shuffle
|
||||
- reverse</code></pre>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<div>
|
||||
|
||||
|
@ -1031,7 +1119,7 @@ chars <span class="o">=</span> names
|
|||
<br/>
|
||||
<div>
|
||||
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/7c586eb9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L37" target="_blank">View source</a>]
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/cd18c6a0/src/ameba/rule/performance/chained_call_with_no_bang.cr#L39" target="_blank">View source</a>]
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1201,7 +1289,7 @@ chars <span class="o">=</span> names
|
|||
<br/>
|
||||
<div>
|
||||
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/7c586eb9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L66" target="_blank">View source</a>]
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/cd18c6a0/src/ameba/rule/performance/chained_call_with_no_bang.cr#L68" target="_blank">View source</a>]
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1217,7 +1305,7 @@ chars <span class="o">=</span> names
|
|||
<br/>
|
||||
<div>
|
||||
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/7c586eb9/src/ameba/rule/performance/chained_call_with_no_bang.cr#L57" target="_blank">View source</a>]
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/cd18c6a0/src/ameba/rule/performance/chained_call_with_no_bang.cr#L59" target="_blank">View source</a>]
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue