PMD CI (pmd-bot) 2023-05-12 11:52:02 +00:00
parent 1627ddf681
commit 7704b91548
7 changed files with 351 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://docs.pmd-code.org/latest/</link>
<atom:link href="https://docs.pmd-code.org/latest/feed.xml" rel="self" type="application/rss+xml"/>
<pubDate>Fri, 12 May 2023 07:58:40 +0000</pubDate>
<lastBuildDate>Fri, 12 May 2023 07:58:40 +0000</lastBuildDate>
<pubDate>Fri, 12 May 2023 11:48:55 +0000</pubDate>
<lastBuildDate>Fri, 12 May 2023 11:48:55 +0000</lastBuildDate>
<generator>Jekyll v3.9.3</generator>
</channel>

View File

@ -1636,6 +1636,13 @@ for all.</p>
<p>This section lists the most important changes from the last release candidate.
The remaining section describes the complete release notes for 7.0.0.</p>
<h4 id="new-cpd-report-format-cpdhtml-v2xslt">New CPD report format cpdhtml-v2.xslt</h4>
<p>Thanks to @mohan-chinnappan-n a new CPD report format has been added which features a data table.
It uses an XSLT stylesheet to convert CPDs XML format into HTML.</p>
<p>See <a href="report-examples/cpdhtml-v2.html">the example report</a>.</p>
<h4 id="fixed-issues">Fixed issues</h4>
<ul>
@ -1672,6 +1679,7 @@ The remaining section describes the complete release notes for 7.0.0.</p>
<h4 id="external-contributions">External Contributions</h4>
<ul>
<li><a href="https://github.com/pmd/pmd/pull/4426">#4426</a>: [cpd] New XML to HTML XLST report format for PMD CPD - <a href="https://github.com/mohan-chinnappan-n">mohan-chinnappan-n</a> (@mohan-chinnappan-n)</li>
<li><a href="https://github.com/pmd/pmd/pull/4540">#4540</a>: [java] Fix #4457: false negative about OverrideBothEqualsAndHashcode - <a href="https://github.com/LynnBroe">AnnaDev</a> (@LynnBroe)</li>
</ul>
@ -1738,6 +1746,13 @@ The remaining section describes the complete release notes for 7.0.0.</p>
<p>This PMD release ships a new version of the pmd-designer.
For the changes, see <a href="https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc1">PMD Designer Changelog</a>.</p>
<h4 id="new-cpd-report-format-cpdhtml-v2xslt-1">New CPD report format cpdhtml-v2.xslt</h4>
<p>Thanks to @mohan-chinnappan-n a new CPD report format has been added which features a data table.
It uses an XSLT stylesheet to convert CPDs XML format into HTML.</p>
<p>See <a href="report-examples/cpdhtml-v2.html">the example report</a>.</p>
<h3 id="-language-related-changes">🎉 Language Related Changes</h3>
<p>Note that this is just a concise listing of the highlight.
@ -2281,6 +2296,7 @@ of the changes listed here, see <a href="pmd_release_notes_pmd7.html">Detailed R
<li><a href="https://github.com/pmd/pmd/pull/4402">#4402</a>: [javascript] CPD: add support for Typescript using antlr4 grammar - <a href="https://github.com/pguyot">Paul Guyot</a> (@pguyot)</li>
<li><a href="https://github.com/pmd/pmd/pull/4403">#4403</a>: [julia] CPD: Add support for Julia code duplication - <a href="https://github.com/wener-tiobe">Wener</a> (@wener-tiobe)</li>
<li><a href="https://github.com/pmd/pmd/pull/4412">#4412</a>: [doc] Added new error msg to ConstantsInInterface - <a href="https://github.com/dague1">David Ljunggren</a> (@dague1)</li>
<li><a href="https://github.com/pmd/pmd/pull/4426">#4426</a>: [cpd] New XML to HTML XLST report format for PMD CPD - <a href="https://github.com/mohan-chinnappan-n">mohan-chinnappan-n</a> (@mohan-chinnappan-n)</li>
<li><a href="https://github.com/pmd/pmd/pull/4428">#4428</a>: [apex] ApexBadCrypto bug fix for #4427 - inline detection of hard coded values - <a href="https://github.com/sfdcsteve">Steven Stearns</a> (@sfdcsteve)</li>
<li><a href="https://github.com/pmd/pmd/pull/4444">#4444</a>: [java] CommentDefaultAccessModifier - ignore org.junit.jupiter.api.extension.RegisterExtension by default - <a href="https://github.com/nirvikpatel">Nirvik Patel</a> (@nirvikpatel)</li>
<li><a href="https://github.com/pmd/pmd/pull/4450">#4450</a>: [java] Fix #4449 AvoidAccessibilityAlteration: Correctly handle Lambda expressions in PrivilegedAction scenarios - <a href="https://github.com/mohui1999">Seren</a> (@mohui1999)</li>

View File

@ -2053,6 +2053,13 @@ to leverage existing grammars.</p>
<p>This PMD release ships a new version of the pmd-designer.
For the changes, see <a href="https://github.com/pmd/pmd-designer/releases/tag/7.0.0-rc1">PMD Designer Changelog</a>.</p>
<h4 id="new-cpd-report-format-cpdhtml-v2xslt">New CPD report format cpdhtml-v2.xslt</h4>
<p>Thanks to @mohan-chinnappan-n a new CPD report format has been added which features a data table.
It uses an XSLT stylesheet to convert CPDs XML format into HTML.</p>
<p>See <a href="report-examples/cpdhtml-v2.html">the example report</a>.</p>
<h2 id="-language-related-changes">🎉 Language Related Changes</h2>
<h3 id="new-swift-support">New: Swift support</h3>

View File

@ -2410,7 +2410,7 @@ to be “debug”.</p>
<ul>
<li>text : Default format</li>
<li>xml</li>
<li>xml (and xslt)</li>
<li>csv</li>
<li>csv_with_linecount_per_file</li>
<li>vs</li>
@ -2754,6 +2754,8 @@ the CPD task as usual and right after it invoke the Ant XSLT script like this:</
<div class="language-xml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;xslt</span> <span class="na">in=</span><span class="s">"cpd.xml"</span> <span class="na">style=</span><span class="s">"etc/xslt/cpdhtml.xslt"</span> <span class="na">out=</span><span class="s">"cpd.html"</span> <span class="nt">/&gt;</span>
</code></pre></div></div>
<p>See <a href="pmd_userdocs_cpd_report_formats.html#xslt">section “xslt” in CPD Report Formats</a> for more examples.</p>
<h2 id="gui">GUI</h2>
<p>CPD also comes with a simple GUI. You can start it through the unified CLI interface provided in the <code class="language-plaintext highlighter-rouge">bin</code> folder:</p>

View File

@ -1696,7 +1696,8 @@ Starting at line 110 of /home/pmd/source/pmd-core/src/test/java/net/sourceforge/
<h2 id="xml">xml</h2>
<p>This format uses XML to output the duplications in a more structured format.</p>
<p>This format uses XML to output the duplications in a more structured format.
The XML format can then further be processed using XSLT transformations. See <a href="#xslt">section xslt</a> for examples.</p>
<p>Example:</p>
@ -1816,6 +1817,41 @@ is shown in the console. You can then click on the filenames to jump to the sour
/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/JaxenXPathRuleQueryTest.java(110): Between lines 110 and 126
</code></pre></div></div>
<h2 id="xslt">xslt</h2>
<p>This is not a direct report format. But you can use <code class="language-plaintext highlighter-rouge">xml</code> to generate an XML report and then use one of the following
XSLT stylesheets to convert the report into html. Or you can write your own stylesheet.</p>
<p>You can either use <a href="https://ant.apache.org/manual/Tasks/style.html">Ants XSLT task</a> or use any other (CLI) xslt processor,
e.g. <code class="language-plaintext highlighter-rouge">xalan</code> (see <a href="https://xalan.apache.org/">https://xalan.apache.org/</a>).</p>
<h3 id="cpdhtmlxslt">cpdhtml.xslt</h3>
<p>This stylesheet is available in the sources or from GitHub at: <a href="https://raw.githubusercontent.com/pmd/pmd/master/pmd-core/etc/xslt/cpdhtml.xslt">https://raw.githubusercontent.com/pmd/pmd/master/pmd-core/etc/xslt/cpdhtml.xslt</a>.</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xalan <span class="nt">-in</span> cpd-report-sample.xml <span class="nt">-xsl</span> cpdhtml.xslt <span class="nt">-out</span> cpd-report-sample-cpdhtml.html
</code></pre></div></div>
<p><a href="report-examples/cpdhtml.html">Example</a></p>
<p>This stylesheet by default only consideres duplications longer than 30 lines. You can change the default value with
the param <code class="language-plaintext highlighter-rouge">lines</code>:</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xalan <span class="nt">-in</span> cpd-report-sample.xml <span class="nt">-xsl</span> cpdhtml.xslt <span class="nt">-out</span> cpd-report-sample-cpdhtml.html <span class="nt">-param</span> lines 10
</code></pre></div></div>
<h3 id="cpdhtml-v2xslt">cpdhtml-v2.xslt</h3>
<p>This stylesheet is available in the sources or from GitHub at: <a href="https://raw.githubusercontent.com/pmd/pmd/master/pmd-core/etc/xslt/cpdhtml-v2.xslt">https://raw.githubusercontent.com/pmd/pmd/master/pmd-core/etc/xslt/cpdhtml-v2.xslt</a>.</p>
<div class="language-shell highlighter-rouge"><div class="highlight"><pre class="highlight"><code>xalan <span class="nt">-in</span> pmd-core-cpd-report.xml <span class="nt">-xsl</span> etc/xslt/cpdhtml-v2.xslt <span class="nt">-out</span> pmd-core-cpd-report-v2.html
</code></pre></div></div>
<p><a href="report-examples/cpdhtml-v2.html">Example</a></p>
<p>It requires javascript enabled and uses <a href="https://getbootstrap.com/">Bootstrap</a>,
<a href="https://jquery.com/">jQuery</a>, and <a href="https://datatables.net/">DataTables</a>.</p>
<div class="tags">

View File

@ -0,0 +1,175 @@
<!DOCTYPE HTML SYSTEM "about:legacy-compat">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.7.0.min.js" integrity="sha256-2Pmvv0kuTBOenSvLm6bvfBSSHrUJ+3A7x6P5Ebd07/g=" crossorigin="anonymous"></script>
<link href="https://cdn.datatables.net/v/bs5/jszip-2.5.0/dt-1.13.4/b-2.3.6/b-html5-2.3.6/b-print-2.3.6/datatables.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script><script src="https://cdn.datatables.net/v/bs5/jszip-2.5.0/dt-1.13.4/b-2.3.6/b-html5-2.3.6/b-print-2.3.6/datatables.min.js"></script>
</head>
<body style="padding-top: 3.5rem;">
<nav class="navbar navbar-expand-lg fixed-top navbar-dark bg-dark">
<a class="navbar-brand" href="#">PMD - CPD (Copy and Paste Detector)</a><button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" href="#">Home</a>
</li>
<li class="nav-item" id="nav_enable_datatable">
<a class="nav-link" href="?d=">Enable datatable</a>
</li>
<li class="nav-item" id="nav_disable_datatable">
<a class="nav-link" href="?">Disable datatable</a>
</li>
<li class="nav-item">
<a class="nav-link" target="_blank" rel="noopener noreferrer" href="https://docs.pmd-code.org/latest/pmd_userdocs_cpd.html#refactoring-duplicates">About Refactoring Duplicates</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col">
<h4>Summary of duplicated code</h4>
<p>This page summarizes the code fragments that have been found to be replicated in the code.</p>
<table class="table table-light table-bordered table-striped table-hover">
<tr>
<th># Duplications</th><th>Total lines</th><th>Total tokens</th><th>Approximate number of bytes</th>
</tr>
<tr>
<td class="SummaryNumber">2</td><td class="SummaryNumber">49</td><td class="SummaryNumber">349</td><td class="SummaryNumber">1396</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col">
<h4>Details of duplicated code</h4>
</div>
<table style="width:100%" id="data_table" class="table table-light table-bordered table-striped table-hover">
<thead>
<tr>
<th>lines</th><th>tokens</th><th>files</th><th>codefragment</th>
</tr>
</thead>
<tbody>
<tr>
<td>33</td><td>239</td><td>
<table class="table table-light table-bordered table-striped table-hover">
<tr>
<th>column</th><th>endcolumn</th><th>line</th><th>endline</th><th>path</th>
</tr>
<tr>
<td>29</td><td>75</td><td>32</td><td>64</td><td>/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java</td>
</tr>
<tr>
<td>37</td><td>75</td><td>68</td><td>100</td><td>/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java</td>
</tr>
</table>
</td><td>
<pre> public void testOverride() {
final StringProperty PROPERTY1_DESCRIPTOR = new StringProperty("property1", "Test property", null, 0f);
MockRule rule = new MockRule();
rule.definePropertyDescriptor(PROPERTY1_DESCRIPTOR);
rule.setLanguage(LanguageRegistry.getLanguage(Dummy2LanguageModule.NAME));
rule.setName("name1");
rule.setProperty(PROPERTY1_DESCRIPTOR, "value1");
rule.setMessage("message1");
rule.setDescription("description1");
rule.addExample("example1");
rule.setExternalInfoUrl("externalInfoUrl1");
rule.setPriority(RulePriority.HIGH);
final StringProperty PROPERTY2_DESCRIPTOR = new StringProperty("property2", "Test property", null, 0f);
RuleReference ruleReference = new RuleReference();
ruleReference.setRule(rule);
ruleReference.definePropertyDescriptor(PROPERTY2_DESCRIPTOR);
ruleReference.setLanguage(LanguageRegistry.getLanguage(DummyLanguageModule.NAME));
ruleReference
.setMinimumLanguageVersion(LanguageRegistry.getLanguage(DummyLanguageModule.NAME).getVersion("1.3"));
ruleReference
.setMaximumLanguageVersion(LanguageRegistry.getLanguage(DummyLanguageModule.NAME).getVersion("1.7"));
ruleReference.setDeprecated(true);
ruleReference.setName("name2");
ruleReference.setProperty(PROPERTY1_DESCRIPTOR, "value2");
ruleReference.setProperty(PROPERTY2_DESCRIPTOR, "value3");
ruleReference.setMessage("message2");
ruleReference.setDescription("description2");
ruleReference.addExample("example2");
ruleReference.setExternalInfoUrl("externalInfoUrl2");
ruleReference.setPriority(RulePriority.MEDIUM_HIGH);
validateOverriddenValues(PROPERTY1_DESCRIPTOR, PROPERTY2_DESCRIPTOR, ruleReference);</pre>
</td>
</tr>
<tr>
<td>16</td><td>110</td><td>
<table class="table table-light table-bordered table-striped table-hover">
<tr>
<th>column</th><th>endcolumn</th><th>line</th><th>endline</th><th>path</th>
</tr>
<tr>
<td>9</td><td>28</td><td>66</td><td>81</td><td>/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/JaxenXPathRuleQueryTest.java</td>
</tr>
<tr>
<td>9</td><td>28</td><td>88</td><td>103</td><td>/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/JaxenXPathRuleQueryTest.java</td>
</tr>
<tr>
<td>9</td><td>28</td><td>110</td><td>125</td><td>/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/lang/rule/xpath/JaxenXPathRuleQueryTest.java</td>
</tr>
</table>
</td><td>
<pre> JaxenXPathRuleQuery query = createQuery(xpath);
List&lt;String&gt; ruleChainVisits = query.getRuleChainVisits();
Assert.assertEquals(2, ruleChainVisits.size());
Assert.assertTrue(ruleChainVisits.contains("dummyNode"));
// Note: Having AST_ROOT in the rule chain visits is probably a mistake. But it doesn't hurt, it shouldn't
// match a real node name.
Assert.assertTrue(ruleChainVisits.contains(JaxenXPathRuleQuery.AST_ROOT));
DummyNodeWithListAndEnum dummy = new DummyNodeWithListAndEnum(1);
RuleContext data = new RuleContext();
data.setLanguageVersion(LanguageRegistry.findLanguageByTerseName("dummy").getDefaultVersion());
query.evaluate(dummy, data);
// note: the actual xpath queries are only available after evaluating
Assert.assertEquals(2, query.nodeNameToXPaths.size());
Assert.assertEquals("self::node()[(attribute::Test1 = \"false\")][(attribute::Test2 = \"true\")]", query.nodeNameToXPaths.get("dummyNode").get(0).toString());</pre>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<script>
let params = (new URL(document.location)).searchParams;
let showDatatable = false;
//------------ can be called with this parameter d
if (params.get('d') !== null) { // got it via query param d
showDatatable = true;
}
if (showDatatable) {
$("#nav_disable_datatable").show();
$("#nav_enable_datatable").hide();
$(document).ready( function () {
$('#data_table').DataTable({
dom: "<'row'<'col-sm-12 col-md-4'B><'col-sm-12 col-md-4'l><'col-sm-12 col-md-4'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
}
);
} );
} else {
$("#nav_disable_datatable").hide();
$("#nav_enable_datatable").show();
}
</script>
</body>
</html>

View File

@ -0,0 +1,111 @@
<!DOCTYPE HTML SYSTEM "about:legacy-compat">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8">
<script type="text/javascript">
function toggleCodeSection(btn, id)
{
area = document.getElementById(id);
if (area.style.display == 'none')
{
btn.innerHTML = '-';
area.style.display = 'inline';
}
else
{
btn.innerHTML = '+';
area.style.display = 'none';
}
}
</script>
<style type="text/css">
.SummaryTitle { }
.SummaryNumber { background-color:#DDDDDD; text-align: center; }
.ItemNumber { background-color: #DDDDDD; }
.CodeFragment { background-color: #BBBBBB; display:none; font:normal normal normal 9pt Courier; }
.ExpandButton { background-color: #FFFFFF; font-size: 8pt; width: 20px; height: 20px; margin:0px; }
</style>
</head>
<body>
<h2>Summary of duplicated code</h2>
This page summarizes the code fragments that have been found to be replicated in the code.
Only those fragments longer than 30 lines of code are shown.
<p></p>
<table border="1" class="summary" cellpadding="2">
<tr style="background-color:#CCCCCC;">
<th># duplications</th><th>Total lines</th><th>Total tokens</th><th>Approx # bytes</th>
</tr>
<tr>
<td class="SummaryNumber">1</td><td class="SummaryNumber">33</td><td class="SummaryNumber">239</td><td class="SummaryNumber">956</td>
</tr>
</table>
<p></p>
You expand and collapse the code fragments using the + buttons. You can also navigate to the source code by clicking
on the file names.
<p></p>
<table>
<tr style="background-color: #444444; color: #DDDDDD;">
<td>ID</td><td>Files</td><td>Lines</td>
</tr>
<tr>
<td class="ItemNumber">1</td><td>
<table>
<tr>
<td><a href="../src//home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java.html#32">/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java</a></td><td> line 32</td>
</tr>
<tr>
<td><a href="../src//home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java.html#68">/home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java</a></td><td> line 68</td>
</tr>
</table>
</td><td># lines : 33</td>
</tr>
<tr>
<td></td><td colspan="2" valign="top">
<table>
<tr>
<td valign="top"><button class="ExpandButton" onclick="blur(); toggleCodeSection(this, 'frag_1')">+</button></td><td><textarea cols="100" wrap="off" class="CodeFragment" style="display:none;" rows="30" id="frag_1"> public void testOverride() {
final StringProperty PROPERTY1_DESCRIPTOR = new StringProperty("property1", "Test property", null, 0f);
MockRule rule = new MockRule();
rule.definePropertyDescriptor(PROPERTY1_DESCRIPTOR);
rule.setLanguage(LanguageRegistry.getLanguage(Dummy2LanguageModule.NAME));
rule.setName("name1");
rule.setProperty(PROPERTY1_DESCRIPTOR, "value1");
rule.setMessage("message1");
rule.setDescription("description1");
rule.addExample("example1");
rule.setExternalInfoUrl("externalInfoUrl1");
rule.setPriority(RulePriority.HIGH);
final StringProperty PROPERTY2_DESCRIPTOR = new StringProperty("property2", "Test property", null, 0f);
RuleReference ruleReference = new RuleReference();
ruleReference.setRule(rule);
ruleReference.definePropertyDescriptor(PROPERTY2_DESCRIPTOR);
ruleReference.setLanguage(LanguageRegistry.getLanguage(DummyLanguageModule.NAME));
ruleReference
.setMinimumLanguageVersion(LanguageRegistry.getLanguage(DummyLanguageModule.NAME).getVersion("1.3"));
ruleReference
.setMaximumLanguageVersion(LanguageRegistry.getLanguage(DummyLanguageModule.NAME).getVersion("1.7"));
ruleReference.setDeprecated(true);
ruleReference.setName("name2");
ruleReference.setProperty(PROPERTY1_DESCRIPTOR, "value2");
ruleReference.setProperty(PROPERTY2_DESCRIPTOR, "value3");
ruleReference.setMessage("message2");
ruleReference.setDescription("description2");
ruleReference.addExample("example2");
ruleReference.setExternalInfoUrl("externalInfoUrl2");
ruleReference.setPriority(RulePriority.MEDIUM_HIGH);
validateOverriddenValues(PROPERTY1_DESCRIPTOR, PROPERTY2_DESCRIPTOR, ruleReference);</textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
</table>
</body>
</html>