mirror of
https://github.com/github/codeql.git
synced 2026-01-07 19:50:22 +01:00
42 lines
1.3 KiB
XML
42 lines
1.3 KiB
XML
<!DOCTYPE qhelp PUBLIC
|
|
"-//Semmle//qhelp//EN"
|
|
"qhelp.dtd">
|
|
<qhelp>
|
|
<overview>
|
|
<p>
|
|
Duplicate scripts with identical or very similar contents indicate poorly structured
|
|
code that is hard to maintain. The artificially inflated amount of code hinders comprehension,
|
|
and ranges of similar but subtly different lines can mask the real purpose or intention behind
|
|
a function. Duplicate scripts can also suffer from update anomalies, where only one of several
|
|
copies of the code is updated to address a defect or add a feature, causing them to slowly
|
|
evolve apart.
|
|
</p>
|
|
|
|
</overview>
|
|
<recommendation>
|
|
|
|
<p>
|
|
Usually, script duplication can be addressed by removing all but one of the duplicates and
|
|
including the (now canonical) single remaining script wherever the other scripts were previously
|
|
used.
|
|
</p>
|
|
|
|
<p>
|
|
If the scripts are mostly, but not completely, identical, it is often possible to factor
|
|
out the common functionality into a new script. This improves reusability and resolves
|
|
the code duplication.
|
|
</p>
|
|
|
|
</recommendation>
|
|
<references>
|
|
|
|
|
|
<li>Elmar Juergens, Florian Deissenboeck, Benjamin Hummel, and Stefan Wagner. 2009.
|
|
Do code clones matter? In <em>Proceedings of the 31st International Conference on
|
|
Software Engineering</em> (ICSE '09). IEEE Computer Society, Washington, DC, USA,
|
|
485-495.
|
|
</li>
|
|
|
|
</references>
|
|
</qhelp>
|