-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
26 lines (25 loc) · 10.5 KB
/
test.html
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
<html><head> <script> function toggle(id) { var item = document.getElementById(id); item.classList.toggle('hidden'); } </script> <style> @media (min-width: 1366px) { body { max-width: 80%; margin: auto; } } body { font-family: sans-serif; } a { color: #2f838a; } a:hover { color: #333; } em { font-weight: bold; font-style: italic; } h1 { padding: 0.5ex 0.2ex; border-bottom: 2px solid #333; } table { width: 100%; border-spacing: 0; } table tr > th { text-align: left; } table caption { font-weight: bold; padding: 1ex 0.5ex; text-align: left; font-size: 120%; border-bottom: 2px solid #333; } tbody tr:nth-child(odd) { background: rgba(0, 0, 0, 0.08); } tbody tr:hover { background: #ffee99; } thead th { border-bottom: 1px solid #aaa; } table td, table th { padding: 0.5ex; } /* Table 'count' and 'percentage' column */ .t-cnt, .t-pct { width: 5em; } .t-pct { opacity: 0.8; font-style: italic; font-size: 80%; } /* Table bar chart */ .t-bar { height: 0.5ex; margin-top: 0.5ex; background-color: #2f838a; /* rgba(47, 131, 138, 0.2); */ } section, table { margin-bottom: 2em; } #details-link.hidden { display: none; } #details-wrapper.hidden { display: none; } ul.code { margin: 0; padding: 0; } ul.code.hidden { display: none; } ul.code li { display: flex; line-height: 1.4em; font-family: monospace; white-space: nowrap; } ul.code li:nth-child(odd) { background-color: rgba(47, 131, 138, 0.1) } /* Excerpt: Line number */ ul.code .no { width: 5%; min-width: 5em; text-align: right; border-right: 1px solid rgba(47, 131, 138, 0.6); padding-right: 1ex; box-sizing: border-box; } /* Excerpt: Code */ ul.code .cd { padding-left: 1ex; white-space: pre-wrap; box-sizing: border-box; word-wrap: break-word; overflow: hidden; } .hlt { background: #ffee99 !important } .prio { color: #333; float: right; } .indx { padding: 0.5ex 1ex; background-color: #000; color: #fff; text-decoration: none; } .indx:hover { background-color: #2f838a; color: #fff; } /* Problem container */ .prb h3 { padding: 1ex 0.5ex; border-bottom: 2px solid #000; font-size: 95%; margin: 0; } .info-lnk { font-style: italic !important; font-weight: normal !important; text-decoration: none; } .info-lnk.blck { padding: 0.5ex 1ex; background-color: rgba(47, 131, 138, 0.2); } .path-basename { font-weight: bold; } .hlt-info { display: inline-block; padding: 2px 4px; font-style: italic; } .hlt-info.quoted { background-color: #92de71; } .hlt-info.variable { background-color: #a3d2ff; } .hlt-info.method { background-color: #f7c0ff; } .sub-info { padding: 1ex 0.5ex; } /* Handle printer friendly styles */ @media print { body, th { font-size: 10pt; } .hlt-info { padding: 0; background: none; } section, table { margin-bottom: 1em; } h1, h2, h3, table caption { padding: 0.5ex 0.2ex; } .prb h3 { border-bottom: 0.5px solid #aaa; } .t-bar { display: none; } .info-lnk { display: none; } #details-wrapper { display: block !important; font-size: 90% !important; } } </style>
<title>PHPMD Report</title></head><body>
<header>
<h1>PHPMD Report</h1>
Generated at <em>2021-07-19 08:55</em>
with <a href='https://phpmd.org' target='_blank'>PHP Mess Detector</a>
on <em>PHP 7.4.19</em>
on <em>Frederiks-MacBook-Pro.local</em>
</header>
<h3>4 problems found</h3><h2>Summary</h2><section><table><caption>By priority</caption><thead><tr><th>Count</th><th>%</th><th>Priority</th></tr></thead><tr> <td class='t-cnt'>2</td> <td class='t-pct'>50.0 %</td> <th class='t-n'>Top (1)<div class="t-bar" style="width: 100%; opacity: 1.00"></div></th> </tr><tr> <td class='t-cnt'>2</td> <td class='t-pct'>50.0 %</td> <th class='t-n'>Moderate (3)<div class="t-bar" style="width: 100%; opacity: 1.00"></div></th> </tr></table></section>
<section><table><caption>By rule set</caption><thead><tr><th>Count</th><th>%</th><th>Rule set</th></tr></thead><tr> <td class='t-cnt'>2</td> <td class='t-pct'>50.0 %</td> <th class='t-n'>Clean Code Rules<div class="t-bar" style="width: 100%; opacity: 1.00"></div></th> </tr><tr> <td class='t-cnt'>1</td> <td class='t-pct'>25.0 %</td> <th class='t-n'>Unused Code Rules<div class="t-bar" style="width: 50%; opacity: 0.70"></div></th> </tr><tr> <td class='t-cnt'>1</td> <td class='t-pct'>25.0 %</td> <th class='t-n'>Naming Rules<div class="t-bar" style="width: 50%; opacity: 0.70"></div></th> </tr></table></section>
<section><table><caption>By name</caption><thead><tr><th>Count</th><th>%</th><th>Rule name</th></tr></thead><tr> <td class='t-cnt'>1</td> <td class='t-pct'>25.0 %</td> <th class='t-n'>StaticAccess<div class="t-bar" style="width: 100%; opacity: 1.00"></div></th> </tr><tr> <td class='t-cnt'>1</td> <td class='t-pct'>25.0 %</td> <th class='t-n'>UnusedLocalVariable<div class="t-bar" style="width: 100%; opacity: 1.00"></div></th> </tr><tr> <td class='t-cnt'>1</td> <td class='t-pct'>25.0 %</td> <th class='t-n'>LongVariable<div class="t-bar" style="width: 100%; opacity: 1.00"></div></th> </tr><tr> <td class='t-cnt'>1</td> <td class='t-pct'>25.0 %</td> <th class='t-n'>ElseExpression<div class="t-bar" style="width: 100%; opacity: 1.00"></div></th> </tr></table></section>
<h2 style='page-break-before: always'>Details</h2>
<a
id='details-link'
class='info-lnk blck'
href='#'
onclick='toggle("details-link"); toggle("details-wrapper"); return false;'
>
Show details ▼
</a><div id='details-wrapper' class='hidden'> <section class='prb' id='p-0'> <header> <h3> <a href='#p-0' class='indx'>#1</a> Avoid using static access to class <span class='hlt-info quoted'>'FredBradley\CranleighEPQShowcase\Template'</span> in <span class='hlt-info method'>method 'setupPlugin'</span>. <a class='info-lnk' href='https://phpmd.org/rules/cleancode.html#staticaccess' target='_blank'>(help)</a> <span class='prio'>Top (1)</span> </h3> </header> <div class='sub-info'><b>File:</b> <a href='file:///Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/Plugin.php' target='_blank'>/Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/<span class='path-basename'>Plugin.php</span></a> <a class='info-lnk blck' href='#' onclick='toggle("p-0-code"); return false;'> Show code ▼ </a></div> <ul class='code hidden' id='p-0-code'><li><div class='no'>23</div><div class='cd'> {</div></li><li><div class='no'>24</div><div class='cd'> $this->createCustomPostType('EPQ Showcase')->register();</div></li><li class='hlt'><div class='no'>25</div><div class='cd'> Template::register();</div></li><li><div class='no'>26</div><div class='cd'> if (is_admin()) {</div></li><li><div class='no'>27</div><div class='cd'> $settings = new Settings($this->post_type);</div></li></ul> </section>
<section class='prb' id='p-1'> <header> <h3> <a href='#p-1' class='indx'>#2</a> Avoid unused local variables such as <span class='hlt-info quoted'>'$settings'</span>. <a class='info-lnk' href='https://phpmd.org/rules/unusedcode.html#unusedlocalvariable' target='_blank'>(help)</a> <span class='prio'>Moderate (3)</span> </h3> </header> <div class='sub-info'><b>File:</b> <a href='file:///Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/Plugin.php' target='_blank'>/Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/<span class='path-basename'>Plugin.php</span></a> <a class='info-lnk blck' href='#' onclick='toggle("p-1-code"); return false;'> Show code ▼ </a></div> <ul class='code hidden' id='p-1-code'><li><div class='no'>25</div><div class='cd'> Template::register();</div></li><li><div class='no'>26</div><div class='cd'> if (is_admin()) {</div></li><li class='hlt'><div class='no'>27</div><div class='cd'> $settings = new Settings($this->post_type);</div></li><li><div class='no'>28</div><div class='cd'> }</div></li><li><div class='no'>29</div><div class='cd'> }</div></li></ul> </section>
<section class='prb' id='p-2'> <header> <h3> <a href='#p-2' class='indx'>#3</a> Avoid excessively long variable names like <span class='hlt-info variable'>$epq_showcase_settings_options</span>. Keep variable name length under 20. <a class='info-lnk' href='https://phpmd.org/rules/naming.html#longvariable' target='_blank'>(help)</a> <span class='prio'>Moderate (3)</span> </h3> </header> <div class='sub-info'><b>File:</b> <a href='file:///Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/Settings.php' target='_blank'>/Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/<span class='path-basename'>Settings.php</span></a> <a class='info-lnk blck' href='#' onclick='toggle("p-2-code"); return false;'> Show code ▼ </a></div> <ul class='code hidden' id='p-2-code'><li><div class='no'>8</div><div class='cd'></div></li><li><div class='no'>9</div><div class='cd'> class Settings {</div></li><li class='hlt'><div class='no'>10</div><div class='cd'> private $epq_showcase_settings_options;</div></li><li><div class='no'>11</div><div class='cd'></div></li><li><div class='no'>12</div><div class='cd'> private $post_type;</div></li></ul> </section>
<section class='prb' id='p-3'> <header> <h3> <a href='#p-3' class='indx'>#4</a> The <span class='hlt-info method'>method blurb_from_jlt_0_callback</span> uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. <a class='info-lnk' href='https://phpmd.org/rules/cleancode.html#elseexpression' target='_blank'>(help)</a> <span class='prio'>Top (1)</span> </h3> </header> <div class='sub-info'><b>File:</b> <a href='file:///Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/Settings.php' target='_blank'>/Users/frederikbradley/Sites/website-2016/wp-content/plugins/cranleigh-epq-showcase/src/<span class='path-basename'>Settings.php</span></a> <a class='info-lnk blck' href='#' onclick='toggle("p-3-code"); return false;'> Show code ▼ </a></div> <ul class='code hidden' id='p-3-code'><li><div class='no'>93</div><div class='cd'> if ( isset( $this->epq_showcase_settings_options['blurb_from_jlt_0'] ) ) {</div></li><li><div class='no'>94</div><div class='cd'> $content = esc_attr( $this->epq_showcase_settings_options['blurb_from_jlt_0'] );</div></li><li class='hlt'><div class='no'>95</div><div class='cd'> } else {</div></li><li><div class='no'>96</div><div class='cd'> $content = '';</div></li><li><div class='no'>97</div><div class='cd'> }</div></li></ul> </section>
</div></body></html>