| Total Complexity | 1 |
| Total Lines | 29 |
| Duplicated Lines | 100 % |
| Coverage | 85.71% |
| Changes | 2 | ||
| Bugs | 0 | Features | 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 | # coding: utf-8 |
||
| 11 | 1 | View Code Duplication | @zope.interface.implementer(INISerializable) |
|
|
|||
| 12 | 1 | class HUD(Model): |
|
| 13 | 1 | no_mission_info = BooleanType( |
|
| 14 | default=False, |
||
| 15 | required=True, |
||
| 16 | ) |
||
| 17 | 1 | no_kill_info = BooleanType( |
|
| 18 | default=False, |
||
| 19 | required=True, |
||
| 20 | ) |
||
| 21 | 1 | display_at_bottom = BooleanType( |
|
| 22 | default=False, |
||
| 23 | required=True, |
||
| 24 | ) |
||
| 25 | |||
| 26 | 1 | @classmethod |
|
| 27 | def from_ini(cls, ini): |
||
| 28 | return cls({ |
||
| 29 | 'no_mission_info': ini.getboolean( |
||
| 30 | 'game', 'NoMissionInfoHud', |
||
| 31 | fallback=cls.no_mission_info.default, |
||
| 32 | ), |
||
| 33 | 'no_kill_info': ini.getboolean( |
||
| 34 | 'game', 'noKillInfoHud', |
||
| 35 | fallback=cls.no_kill_info.default, |
||
| 36 | ), |
||
| 37 | 'display_at_bottom': ini.getboolean( |
||
| 38 | 'game', 'lowInfoHud', |
||
| 39 | fallback=cls.display_at_bottom.default, |
||
| 40 | ), |
||
| 42 |