Merge pull request #4147 from yasarshaikh:master
[java] Added support for Do-While for AvoidArrayLoops #4147
This commit is contained in:
@ -6952,6 +6952,15 @@
|
||||
"code",
|
||||
"doc"
|
||||
]
|
||||
],
|
||||
{
|
||||
"login": "yasarshaikh",
|
||||
"name": "Yasar Shaikh",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/20971327?v=4",
|
||||
"profile": "https://github.com/yasarshaikh",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
@ -747,6 +747,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
<td align="center"><a href="http://xenoamess.com/"><img src="https://avatars.githubusercontent.com/u/17455337?v=4?s=100" width="100px;" alt=""/><br /><sub><b>XenoAmess</b></sub></a><br /><a href="https://github.com/pmd/pmd/commits?author=XenoAmess" title="Code">💻</a> <a href="https://github.com/pmd/pmd/issues?q=author%3AXenoAmess" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://github.com/duanyang25"><img src="https://avatars.githubusercontent.com/u/34642309?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yang</b></sub></a><br /><a href="https://github.com/pmd/pmd/commits?author=duanyang25" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/YaroslavTER"><img src="https://avatars.githubusercontent.com/u/13270181?v=4?s=100" width="100px;" alt=""/><br /><sub><b>YaroslavTER</b></sub></a><br /><a href="https://github.com/pmd/pmd/issues?q=author%3AYaroslavTER" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://github.com/yasarshaikh"><img src="https://avatars.githubusercontent.com/u/20971327?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yasar Shaikh</b></sub></a><br /><a href="https://github.com/pmd/pmd/commits?author=yasarshaikh" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/YYoungC"><img src="https://avatars.githubusercontent.com/u/55069165?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Young Chan</b></sub></a><br /><a href="https://github.com/pmd/pmd/commits?author=YYoungC" title="Code">💻</a> <a href="https://github.com/pmd/pmd/issues?q=author%3AYYoungC" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://dailyco.github.io/"><img src="https://avatars.githubusercontent.com/u/48382813?v=4?s=100" width="100px;" alt=""/><br /><sub><b>YuJin Kim</b></sub></a><br /><a href="https://github.com/pmd/pmd/issues?q=author%3Adailyco" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://github.com/yuridolzhenko"><img src="https://avatars.githubusercontent.com/u/1915205?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Yuri Dolzhenko</b></sub></a><br /><a href="https://github.com/pmd/pmd/issues?q=author%3Ayuridolzhenko" title="Bug reports">🐛</a></td>
|
||||
|
@ -33,11 +33,14 @@ The rule is part of the quickstart.xml ruleset.
|
||||
* [#4163](https://github.com/pmd/pmd/issues/4163): \[doc] Broken links on page "Architecture Decisions"
|
||||
* java-documentation
|
||||
* [#4141](https://github.com/pmd/pmd/issues/4141): \[java] UncommentedEmptyConstructor FP when constructor annotated with @<!-- -->Autowired
|
||||
* java-performance
|
||||
* [#4091](https://github.com/pmd/pmd/issues/4091): \[java] AvoidArrayLoops false negative with do-while loops
|
||||
|
||||
### API Changes
|
||||
|
||||
### External Contributions
|
||||
* [#4142](https://github.com/pmd/pmd/pull/4142): \[java] fix #4141 Update UncommentedEmptyConstructor - ignore @<!-- -->Autowired annotations - [Lynn](https://github.com/LynnBroe) (@LynnBroe)
|
||||
* [#4147](https://github.com/pmd/pmd/pull/4147): \[java] Added support for Do-While for AvoidArrayLoops - [Yasar Shaikh](https://github.com/yasarshaikh) (@yasarshaikh)
|
||||
* [#4150](https://github.com/pmd/pmd/pull/4150): \[apex] New rule ApexUnitTestClassShouldHaveRunAs #4149 - [Thomas Prouvot](https://github.com/tprouvot) (@tprouvot)
|
||||
|
||||
{% endtocmaker %}
|
||||
|
@ -80,7 +80,7 @@ Instead of manually copying data between two arrays, use the efficient Arrays.co
|
||||
<property name="xpath">
|
||||
<value>
|
||||
<![CDATA[
|
||||
//Statement[(ForStatement or WhileStatement) and
|
||||
//Statement[(ForStatement or WhileStatement or DoStatement) and
|
||||
count(*//AssignmentOperator[@Image = '='])=1
|
||||
and
|
||||
*/Statement
|
||||
|
@ -48,6 +48,22 @@ public class Foo {
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>copy via do-while loop #4091</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
public void bar() {
|
||||
int i = 0;
|
||||
do {
|
||||
a[i] = b[i];
|
||||
i++;
|
||||
} while (i < 10);
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>copy involving multiple arrays is ok</description>
|
||||
<expected-problems>0</expected-problems>
|
||||
|
Reference in New Issue
Block a user