Total Complexity | 2 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 2 |
Duplicated Lines | 18 |
Ratio | 100 % |
Changes | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | View Code Duplication | import EngineApp from '../../Framework/engine.js' |
|
|
|||
2 | let eng =new EngineApp() |
||
3 | |||
4 | function articlefrag(id,title,content,target){ |
||
5 | eng.componentsEngine.createComponent("article"+id,articleRender(title,content)) |
||
6 | eng.componentsEngine.renderComponent(target,"article"+id) |
||
7 | } |
||
8 | |||
9 | function articleRender(title,content){ |
||
10 | return "<br><div class='articleFrag'>"+ |
||
11 | "<h1>"+title+"</h1>"+ |
||
12 | "<article>"+content+"</article>"+ |
||
13 | "<hr>"+ |
||
14 | "</div>" |
||
15 | } |
||
16 | |||
17 | |||
18 | export default articlefrag |