Menu

[7e3fed]: / docs / report-examples / cpdhtml-v2.html  Maximize  Restore  History

Download this file

176 lines (168 with data), 7.9 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.