| Total Complexity | 5 |
| Total Lines | 44 |
| Duplicated Lines | 100 % |
| Coverage | 44.44% |
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 | 1 | from plugin.sync.core.enums import SyncData, SyncMode |
|
| 9 | 1 | View Code Duplication | class Push(Mode): |
|
|
|||
| 10 | 1 | data = SyncData.All |
|
| 11 | 1 | mode = SyncMode.Push |
|
| 12 | |||
| 13 | 1 | children = [ |
|
| 14 | Movies, |
||
| 15 | Shows |
||
| 16 | ] |
||
| 17 | |||
| 18 | 1 | @elapsed.clock |
|
| 19 | def construct(self): |
||
| 20 | # Start progress tracking |
||
| 21 | self.current.progress.start() |
||
| 22 | |||
| 23 | # Construct children |
||
| 24 | self.execute_children('construct') |
||
| 25 | |||
| 26 | 1 | @elapsed.clock |
|
| 27 | def start(self): |
||
| 28 | # Fetch changes from trakt.tv |
||
| 29 | self.trakt.refresh() |
||
| 30 | |||
| 31 | # Build key table for lookups |
||
| 32 | self.trakt.build_table() |
||
| 33 | |||
| 34 | # Start children |
||
| 35 | self.execute_children('start') |
||
| 36 | |||
| 37 | 1 | @elapsed.clock |
|
| 38 | def run(self): |
||
| 39 | with self.plex.prime(): |
||
| 40 | # Run children |
||
| 41 | self.execute_children('run') |
||
| 42 | |||
| 43 | # Send artifacts to trakt |
||
| 44 | self.current.artifacts.send() |
||
| 45 | |||
| 46 | 1 | @elapsed.clock |
|
| 47 | def stop(self): |
||
| 48 | # Stop children |
||
| 49 | self.execute_children('stop') |
||
| 50 | |||
| 51 | # Stop progress tracking |
||
| 52 | self.current.progress.stop() |
||
| 53 |