PMD CI (pmd-bot)
2022-07-01 12:36:07 +00:00
parent 4fff3d2921
commit 5a3214a31b
3 changed files with 37 additions and 4 deletions

View File

@ -5,8 +5,8 @@
<description>Intended as a documentation theme based on Jekyll for technical writers documenting software and other technical products, this theme has all the elements you would need to handle multiple products with both multi-level sidebar navigation, tags, and other documentation features.</description>
<link>https://pmd.github.io/pmd/</link>
<atom:link href="https://pmd.github.io/pmd/feed.xml" rel="self" type="application/rss+xml"/>
<pubDate>Fri, 01 Jul 2022 10:50:37 +0000</pubDate>
<lastBuildDate>Fri, 01 Jul 2022 10:50:37 +0000</lastBuildDate>
<pubDate>Fri, 01 Jul 2022 12:34:05 +0000</pubDate>
<lastBuildDate>Fri, 01 Jul 2022 12:34:05 +0000</lastBuildDate>
<generator>Jekyll v3.9.2</generator>
</channel>

View File

@ -1546,6 +1546,11 @@ for the <a href="https://cucumber.io/docs/gherkin/">Gherkin</a> language. It is
<h3 id="fixed-issues">Fixed Issues</h3>
<ul>
<li>java-bestpractices
<ul>
<li><a href="https://github.com/pmd/pmd/issues/3455">#3455</a>: [java] WhileLoopWithLiteralBoolean - false negative with complex expressions</li>
</ul>
</li>
<li>java-performance
<ul>
<li><a href="https://github.com/pmd/pmd/issues/3625">#3625</a>: [java] AddEmptyString - false negative with empty var</li>
@ -1558,6 +1563,7 @@ for the <a href="https://cucumber.io/docs/gherkin/">Gherkin</a> language. It is
<h3 id="external-contributions">External Contributions</h3>
<ul>
<li><a href="https://github.com/pmd/pmd/pull/3984">#3984</a>: [java] Fix AddEmptyString false-negative issue - <a href="https://github.com/LiGaOg">@LiGaOg</a></li>
<li><a href="https://github.com/pmd/pmd/pull/3988">#3988</a>: [java] Modify WhileLoopWithLiteralBoolean to meet the missing case #3455 - <a href="https://github.com/VoidxHoshi">@VoidxHoshi</a></li>
<li><a href="https://github.com/pmd/pmd/pull/4017">#4017</a>: Add Gherkin support to CPD - <a href="https://github.com/ASBrouwers">@ASBrouwers</a></li>
</ul>

View File

@ -4029,8 +4029,33 @@ a block <code class="language-plaintext highlighter-rouge">{}</code> is sufficie
<p><code class="language-plaintext highlighter-rouge">while (false) {}</code> will never execute the block and can be removed in its entirety.</p>
<p><strong>This rule is defined by the following XPath expression:</strong></p>
<div class="language-xpath highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="o">//</span><span class="nt">DoStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="o">/</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">]</span><span class="w"> </span><span class="p">|</span><span class="w">
</span><span class="o">//</span><span class="nt">WhileStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="o">/</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">[</span><span class="na">@True</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">false</span><span class="p">()]]</span><span class="w">
<div class="language-xpath highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c">(: while loops with single boolean literal, maybe parenthesized :)</span><span class="w">
</span><span class="o">//</span><span class="nt">WhileStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(.|(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Expression</span><span class="p">))</span><span class="o">/</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">[</span><span class="na">@True</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">false</span><span class="p">()]]</span><span class="w">
</span><span class="p">|</span><span class="w">
</span><span class="c">(: do-while loops with single boolean literal, maybe parenthesized :)</span><span class="w">
</span><span class="o">//</span><span class="nt">DoStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(.|(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Expression</span><span class="p">))</span><span class="o">/</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">]</span><span class="w">
</span><span class="p">|</span><span class="w">
</span><span class="c">(: while loops with conditional or'ed boolean literals, maybe parenthesized :)</span><span class="w">
</span><span class="o">//</span><span class="nt">WhileStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">InclusiveOrExpression</span><span class="p">|</span><span class="nt">ConditionalOrExpression</span><span class="p">|(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">InclusiveOrExpression</span><span class="p">|</span><span class="nt">ConditionalOrExpression</span><span class="p">)))</span><span class="w">
</span><span class="p">[</span><span class="nf">count</span><span class="p">(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">)</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="m">2</span><span class="p">]</span><span class="w">
</span><span class="c">(: at least one false literal :)</span><span class="w">
</span><span class="p">[</span><span class="nf">count</span><span class="p">(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">[</span><span class="na">@True</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">false</span><span class="p">()])</span><span class="w"> </span><span class="o">&gt;=</span><span class="w"> </span><span class="m">1</span><span class="p">]]</span><span class="w">
</span><span class="p">|</span><span class="w">
</span><span class="c">(: while loops with conditional and'ed boolean literals, maybe parenthesized :)</span><span class="w">
</span><span class="o">//</span><span class="nt">WhileStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">AndExpression</span><span class="p">|</span><span class="nt">ConditionalAndExpression</span><span class="p">|(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">AndExpression</span><span class="p">|</span><span class="nt">ConditionalAndExpression</span><span class="p">)))</span><span class="w">
</span><span class="c">(: at least one false literal :)</span><span class="w">
</span><span class="p">[</span><span class="nf">count</span><span class="p">(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">[</span><span class="na">@True</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">false</span><span class="p">()])</span><span class="w"> </span><span class="o">&gt;=</span><span class="w"> </span><span class="m">1</span><span class="p">]]</span><span class="w">
</span><span class="p">|</span><span class="w">
</span><span class="c">(: do-while loops with conditional or'ed boolean literals, maybe parenthesized :)</span><span class="w">
</span><span class="o">//</span><span class="nt">DoStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">InclusiveOrExpression</span><span class="p">|</span><span class="nt">ConditionalOrExpression</span><span class="p">|(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">InclusiveOrExpression</span><span class="p">|</span><span class="nt">ConditionalOrExpression</span><span class="p">)))</span><span class="w">
</span><span class="p">[</span><span class="nf">count</span><span class="p">(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">)</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="m">2</span><span class="p">]]</span><span class="w">
</span><span class="p">|</span><span class="w">
</span><span class="c">(: do-while loops with conditional and'ed boolean literals, maybe parenthesized :)</span><span class="w">
</span><span class="o">//</span><span class="nt">DoStatement</span><span class="p">[</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">AndExpression</span><span class="p">|</span><span class="nt">ConditionalAndExpression</span><span class="p">|(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Expression</span><span class="err">/</span><span class="p">(</span><span class="nt">AndExpression</span><span class="p">|</span><span class="nt">ConditionalAndExpression</span><span class="p">)))</span><span class="w">
</span><span class="c">(: at least one false literal :)</span><span class="w">
</span><span class="p">[</span><span class="nf">count</span><span class="p">(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">[</span><span class="na">@True</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">false</span><span class="p">()])</span><span class="w"> </span><span class="o">&gt;=</span><span class="w"> </span><span class="m">1</span><span class="w">
</span><span class="c">(: or two true literals (e.g. true &amp; true) :)</span><span class="w">
</span><span class="ow">or</span><span class="w"> </span><span class="nf">count</span><span class="p">(</span><span class="nt">PrimaryExpression</span><span class="o">/</span><span class="nt">PrimaryPrefix</span><span class="o">/</span><span class="nt">Literal</span><span class="o">/</span><span class="nt">BooleanLiteral</span><span class="p">[</span><span class="na">@True</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="nf">true</span><span class="p">()])</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="m">2</span><span class="p">]]</span><span class="w">
</span></code></pre></div></div>
<p><strong>Example(s):</strong></p>
@ -4041,6 +4066,8 @@ a block <code class="language-plaintext highlighter-rouge">{}</code> is sufficie
<span class="k">while</span> <span class="o">(</span><span class="kc">false</span><span class="o">)</span> <span class="o">{</span> <span class="o">}</span> <span class="c1">// disallowed</span>
<span class="k">do</span> <span class="o">{</span> <span class="o">}</span> <span class="k">while</span> <span class="o">(</span><span class="kc">true</span><span class="o">);</span> <span class="c1">// disallowed</span>
<span class="k">do</span> <span class="o">{</span> <span class="o">}</span> <span class="k">while</span> <span class="o">(</span><span class="kc">false</span><span class="o">);</span> <span class="c1">// disallowed</span>
<span class="k">do</span> <span class="o">{</span> <span class="o">}</span> <span class="k">while</span> <span class="o">(</span><span class="kc">false</span> <span class="o">|</span> <span class="kc">false</span><span class="o">);</span> <span class="c1">// disallowed</span>
<span class="k">do</span> <span class="o">{</span> <span class="o">}</span> <span class="k">while</span> <span class="o">(</span><span class="kc">false</span> <span class="o">||</span> <span class="kc">false</span><span class="o">);</span> <span class="c1">// disallowed</span>
<span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>