FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/external/DuplicateBlock.qhelp at codeql-cli-2.27.1 · github/codeql · GitHub
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10.1k
Code
Issues
1k
Pull requests
468
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
ql
/
src
/
external
/
DuplicateBlock.qhelp
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (24 loc) · 1.22 KB
Breadcrumbs
codeql
/
python
/
ql
/
src
/
external
/
DuplicateBlock.qhelp
Copy path
File metadata and controls
31 lines (24 loc) · 1.22 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<!
DOCTYPE
qhelp
PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<
qhelp
>
<
overview
>
<
p
>Blocks of code that are duplicated verbatim in several places in the code are candidates for
refactoring into functions. The severity of this anti-pattern is higher for longer blocks than for short blocks.</
p
>
</
overview
>
<
recommendation
>
<
p
>Code duplication is undesirable for a range of reasons: 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. There's also a risk of
update anomalies, where only one of several copies of the code is updated to address a defect or
add a feature.</
p
>
<
p
>In the case of code block duplication, how to address the issue depends on the blocks of code themselves.
It may be possible to extract the block of code into its own function and call that instead of duplicating the code.</
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
>
Back
|
FazBrowse Home
|
New Git URL