| Total Complexity | 4 | 
| Total Lines | 27 | 
| Duplicated Lines | 85.19 % | 
| 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 | """Module to help to create tests."""  | 
            ||
| 2 | |||
| 3 | |||
| 4 | View Code Duplication | def get_napp_urls(napp):  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 5 | """Return the kytos/topology urls.  | 
            ||
| 6 | |||
| 7 | The urls will be like:  | 
            ||
| 8 | |||
| 9 | urls = [  | 
            ||
| 10 | (options, methods, url)  | 
            ||
| 11 | ]  | 
            ||
| 12 | |||
| 13 | """  | 
            ||
| 14 | controller = napp.controller  | 
            ||
| 15 | controller.api_server.register_napp_endpoints(napp)  | 
            ||
| 16 | |||
| 17 | urls = []  | 
            ||
| 18 | for rule in controller.api_server.app.url_map.iter_rules():  | 
            ||
| 19 |         options = {} | 
            ||
| 20 | for arg in rule.arguments:  | 
            ||
| 21 |             options[arg] = f"[{arg}]" | 
            ||
| 22 | |||
| 23 |         if f'{napp.username}/{napp.name}' in str(rule): | 
            ||
| 24 |             urls.append((options, rule.methods, f'{str(rule)}')) | 
            ||
| 25 | |||
| 26 | return urls  | 
            ||
| 27 |