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 @ 80532da357
🚀
This commit is contained in:
parent
5691d407a5
commit
017e9a8722
121 changed files with 1270 additions and 1270 deletions
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="generator" content="Crystal Docs 1.4.1">
|
||||
<meta name="generator" content="Crystal Docs 1.5.0">
|
||||
<meta name="crystal_docs.project_version" content="master">
|
||||
<meta name="crystal_docs.project_name" content="ameba">
|
||||
|
||||
|
@ -739,7 +739,7 @@ which are mutated during iterations.</p>
|
|||
<p>In most cases it leads to unexpected behaviour and is undesired.</p>
|
||||
<p>For example, having this example:</p>
|
||||
<pre><code class="language-crystal">n <span class="o">=</span> <span class="n">0</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).<span class="k">new</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).new
|
||||
|
||||
<span class="k">while</span> n <span class="o"><</span> <span class="n">3</span>
|
||||
n <span class="o">=</span> n <span class="o">+</span> <span class="n">1</span>
|
||||
|
@ -751,7 +751,7 @@ channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">
|
|||
and when <code>channel.receive</code> is executed its value is <code>3</code>.</p>
|
||||
<p>To solve this, the code above needs to be rewritten to the following:</p>
|
||||
<pre><code class="language-crystal">n <span class="o">=</span> <span class="n">0</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).<span class="k">new</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).new
|
||||
|
||||
<span class="k">while</span> n <span class="o"><</span> <span class="n">3</span>
|
||||
n <span class="o">=</span> n <span class="o">+</span> <span class="n">1</span>
|
||||
|
@ -766,8 +766,8 @@ the second one.</p>
|
|||
<p>There are also other technics to solve the problem above which are
|
||||
<a href="https://crystal-lang.org/reference/guides/concurrency.html">officially documented</a></p>
|
||||
<p>YAML configuration example:</p>
|
||||
<pre><code class="language-crystal">Lint/SharedVarInFiber:
|
||||
Enabled: true</code></pre>
|
||||
<pre><code class="language-crystal"><span class="t">Lint</span><span class="o">/</span><span class="t">SharedVarInFiber</span>:
|
||||
<span class="t">Enabled</span>: <span class="n">true</span></code></pre>
|
||||
|
||||
|
||||
|
||||
|
@ -808,7 +808,7 @@ the second one.</p>
|
|||
</h2>
|
||||
|
||||
|
||||
<a href="https://github.com/crystal-ameba/ameba/blob/97acedae/src/ameba/rule/lint/shared_var_in_fiber.cr#L52" target="_blank">
|
||||
<a href="https://github.com/crystal-ameba/ameba/blob/80532da3/src/ameba/rule/lint/shared_var_in_fiber.cr#L52" target="_blank">
|
||||
ameba/rule/lint/shared_var_in_fiber.cr
|
||||
</a>
|
||||
|
||||
|
@ -1088,7 +1088,7 @@ which are mutated during iterations.</p>
|
|||
<p>In most cases it leads to unexpected behaviour and is undesired.</p>
|
||||
<p>For example, having this example:</p>
|
||||
<pre><code class="language-crystal">n <span class="o">=</span> <span class="n">0</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).<span class="k">new</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).new
|
||||
|
||||
<span class="k">while</span> n <span class="o"><</span> <span class="n">3</span>
|
||||
n <span class="o">=</span> n <span class="o">+</span> <span class="n">1</span>
|
||||
|
@ -1100,7 +1100,7 @@ channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">
|
|||
and when <code>channel.receive</code> is executed its value is <code>3</code>.</p>
|
||||
<p>To solve this, the code above needs to be rewritten to the following:</p>
|
||||
<pre><code class="language-crystal">n <span class="o">=</span> <span class="n">0</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).<span class="k">new</span>
|
||||
channel <span class="o">=</span> <span class="t">Channel</span>(<span class="t">Int32</span>).new
|
||||
|
||||
<span class="k">while</span> n <span class="o"><</span> <span class="n">3</span>
|
||||
n <span class="o">=</span> n <span class="o">+</span> <span class="n">1</span>
|
||||
|
@ -1115,14 +1115,14 @@ the second one.</p>
|
|||
<p>There are also other technics to solve the problem above which are
|
||||
<a href="https://crystal-lang.org/reference/guides/concurrency.html">officially documented</a></p>
|
||||
<p>YAML configuration example:</p>
|
||||
<pre><code class="language-crystal">Lint/SharedVarInFiber:
|
||||
Enabled: true</code></pre>
|
||||
<pre><code class="language-crystal"><span class="t">Lint</span><span class="o">/</span><span class="t">SharedVarInFiber</span>:
|
||||
<span class="t">Enabled</span>: <span class="n">true</span></code></pre>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<div>
|
||||
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/97acedae/src/ameba/rule/lint/shared_var_in_fiber.cr#L52" target="_blank">View source</a>]
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/80532da3/src/ameba/rule/lint/shared_var_in_fiber.cr#L52" target="_blank">View source</a>]
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1264,7 +1264,7 @@ the second one.</p>
|
|||
<br/>
|
||||
<div>
|
||||
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/97acedae/src/ameba/rule/lint/shared_var_in_fiber.cr#L63" target="_blank">View source</a>]
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/80532da3/src/ameba/rule/lint/shared_var_in_fiber.cr#L63" target="_blank">View source</a>]
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1280,7 +1280,7 @@ the second one.</p>
|
|||
<br/>
|
||||
<div>
|
||||
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/97acedae/src/ameba/rule/lint/shared_var_in_fiber.cr#L59" target="_blank">View source</a>]
|
||||
[<a href="https://github.com/crystal-ameba/ameba/blob/80532da3/src/ameba/rule/lint/shared_var_in_fiber.cr#L59" target="_blank">View source</a>]
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue