Deploying to gh-pages from @ crystal-ameba/ameba@52a3e47a3b 🚀

This commit is contained in:
Sija 2023-11-14 09:26:58 +00:00
parent 78ed02da45
commit 4be0551946
146 changed files with 855 additions and 855 deletions

View file

@ -900,12 +900,12 @@
Overview
</h2>
<p>This rule is used to identify usage of <code>index/rindex/find</code> calls
<p>This rule is used to identify usage of <code>index/rindex/find/match</code> calls
followed by a call to <code>not_nil!</code>.</p>
<p>For example, this is considered a code smell:</p>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find(<span class="o">&amp;</span>.match(<span class="o">/</span><span class="o">^</span><span class="t">A</span>.<span class="o">/</span>)).not_nil!</code></pre>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find(<span class="o">&amp;</span>.chars.any?(<span class="o">&amp;</span>.in?(<span class="s">&#39;o&#39;</span>, <span class="s">&#39;b&#39;</span>))).not_nil!</code></pre>
<p>And can be written as this:</p>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find!(<span class="o">&amp;</span>.match(<span class="o">/</span><span class="o">^</span><span class="t">A</span>.<span class="o">/</span>))</code></pre>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find!(<span class="o">&amp;</span>.chars.any?(<span class="o">&amp;</span>.in?(<span class="s">&#39;o&#39;</span>, <span class="s">&#39;b&#39;</span>)))</code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal"><span class="t">Lint</span><span class="o">/</span><span class="t">NotNilAfterNoBang</span>:
<span class="t">Enabled</span>: <span class="n">true</span></code></pre>
@ -951,7 +951,7 @@ followed by a call to <code>not_nil!</code>.</p>
</h2>
<a href="https://github.com/crystal-ameba/ameba/blob/3b87aa6/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23" target="_blank">
<a href="https://github.com/crystal-ameba/ameba/blob/52a3e47/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23" target="_blank">
ameba/rule/lint/not_nil_after_no_bang.cr
</a>
@ -978,7 +978,7 @@ followed by a call to <code>not_nil!</code>.</p>
<dt class="entry-const" id="CALL_NAMES">
<strong>CALL_NAMES</strong> = <code>[<span class="s">&quot;index&quot;</span>, <span class="s">&quot;rindex&quot;</span>] <span class="k">of</span> <span class="t">::</span><span class="t">String</span></code>
<strong>CALL_NAMES</strong> = <code>[<span class="s">&quot;index&quot;</span>, <span class="s">&quot;rindex&quot;</span>, <span class="s">&quot;match&quot;</span>] <span class="k">of</span> <span class="t">::</span><span class="t">String</span></code>
</dt>
@ -1009,7 +1009,7 @@ followed by a call to <code>not_nil!</code>.</p>
<li class="entry-summary">
<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>index/rindex/find</code> calls followed by a call to <code>not_nil!</code>.</p></div>
<div class="summary"><p>This rule is used to identify usage of <code>index/rindex/find/match</code> calls followed by a call to <code>not_nil!</code>.</p></div>
</li>
@ -1349,12 +1349,12 @@ followed by a call to <code>not_nil!</code>.</p>
<div class="doc">
<p>This rule is used to identify usage of <code>index/rindex/find</code> calls
<p>This rule is used to identify usage of <code>index/rindex/find/match</code> calls
followed by a call to <code>not_nil!</code>.</p>
<p>For example, this is considered a code smell:</p>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find(<span class="o">&amp;</span>.match(<span class="o">/</span><span class="o">^</span><span class="t">A</span>.<span class="o">/</span>)).not_nil!</code></pre>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find(<span class="o">&amp;</span>.chars.any?(<span class="o">&amp;</span>.in?(<span class="s">&#39;o&#39;</span>, <span class="s">&#39;b&#39;</span>))).not_nil!</code></pre>
<p>And can be written as this:</p>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find!(<span class="o">&amp;</span>.match(<span class="o">/</span><span class="o">^</span><span class="t">A</span>.<span class="o">/</span>))</code></pre>
<pre><code class="language-crystal"><span class="s">%w[Alice Bob]</span>.find!(<span class="o">&amp;</span>.chars.any?(<span class="o">&amp;</span>.in?(<span class="s">&#39;o&#39;</span>, <span class="s">&#39;b&#39;</span>)))</code></pre>
<p>YAML configuration example:</p>
<pre><code class="language-crystal"><span class="t">Lint</span><span class="o">/</span><span class="t">NotNilAfterNoBang</span>:
<span class="t">Enabled</span>: <span class="n">true</span></code></pre>
@ -1363,7 +1363,7 @@ followed by a call to <code>not_nil!</code>.</p>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/3b87aa6/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/52a3e47/src/ameba/rule/lint/not_nil_after_no_bang.cr#L23" target="_blank">View source</a>]
</div>
</div>
@ -1544,7 +1544,7 @@ followed by a call to <code>not_nil!</code>.</p>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/3b87aa6/src/ameba/rule/lint/not_nil_after_no_bang.cr#L39" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/52a3e47/src/ameba/rule/lint/not_nil_after_no_bang.cr#L39" target="_blank">View source</a>]
</div>
</div>
@ -1560,7 +1560,7 @@ followed by a call to <code>not_nil!</code>.</p>
<br/>
<div>
[<a href="https://github.com/crystal-ameba/ameba/blob/3b87aa6/src/ameba/rule/lint/not_nil_after_no_bang.cr#L35" target="_blank">View source</a>]
[<a href="https://github.com/crystal-ameba/ameba/blob/52a3e47/src/ameba/rule/lint/not_nil_after_no_bang.cr#L35" target="_blank">View source</a>]
</div>
</div>