Skip to content

Commit

Permalink
Deploying to gh-pages from @ 8fb483c 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-gauthier-sonarsource committed May 16, 2024
1 parent 15fbb1b commit 06e8017
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
31 changes: 0 additions & 31 deletions rules/S1871/rpg-description.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,37 +57,6 @@ <h2 id="_why_is_this_an_issue">Why is this an issue?</h2>
<div class="paragraph">
<p>If the same logic is needed for both instances, they should be combined.</p>
</div>
<div class="sect2">
<h3 id="_exceptions">Exceptions</h3>
<div class="paragraph">
<p>Blocks in an <code>if</code> chain or <code>select</code> statement that contain a single line of code are ignored.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-rpg" data-lang="rpg">if (a &gt;= 0 and a &lt; 10);
doTheThing();
elseif (a &gt;= 10 and a &lt; 20);
doTheOtherThing();
elseif (a &gt;= 20 and a &lt; 50);
doTheThing(); //no issue, usually this is done on purpose to increase the readability
else;
doTheRest();
endif;</code></pre>
</div>
</div>
<div class="paragraph">
<p>But this exception does not apply to <code>if</code> chains without <code>else</code>-s, or to <code>select</code>-s without <code>other</code> clauses when all branches have the same single line of code. In the case of <code>if</code> chains with <code>else</code>-s, or of <code>select</code>-s with <code>other</code> clauses, rule <a data-rspec-id="S3923" class="rspec-auto-link">S3923</a> raises a bug.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-rpg" data-lang="rpg">if (a &gt;= 0 and a &lt; 10);
doTheThing();
elseif (a &gt;= 20 and a &lt; 50);
doTheThing(); //Noncompliant, this might have been done on purpose but probably not
endif;</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
Expand Down
2 changes: 1 addition & 1 deletion rules/rule-index.json

Large diffs are not rendered by default.

0 comments on commit 06e8017

Please sign in to comment.