| Total Complexity | 1 |
| Total Lines | 30 |
| Duplicated Lines | 100 % |
| Coverage | 85.71% |
| Changes | 4 | ||
| 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 |
||
| 12 | 1 | View Code Duplication | @zope.interface.implementer(INISerializable) |
|
|
|||
| 13 | 1 | class Logging(Model): |
|
| 14 | 1 | file_name = StringType( |
|
| 15 | default="eventlog.lst", |
||
| 16 | min_length=1, |
||
| 17 | required=True, |
||
| 18 | ) |
||
| 19 | 1 | keep = BooleanType( |
|
| 20 | default=True, |
||
| 21 | required=True, |
||
| 22 | ) |
||
| 23 | 1 | log_buildings = BooleanType( |
|
| 24 | default=False, |
||
| 25 | required=True, |
||
| 26 | ) |
||
| 27 | |||
| 28 | 1 | @classmethod |
|
| 29 | def from_ini(cls, ini): |
||
| 30 | return cls({ |
||
| 31 | 'file_name': ini.get( |
||
| 32 | 'game', 'eventlog', |
||
| 33 | fallback=cls.file_name.default, |
||
| 34 | ), |
||
| 35 | 'keep': ini.getboolean( |
||
| 36 | 'game', 'eventlogkeep', |
||
| 37 | fallback=cls.keep.default, |
||
| 38 | ), |
||
| 39 | 'log_buildings': ini.getboolean( |
||
| 40 | 'game', 'eventlogHouse', |
||
| 41 | fallback=cls.log_buildings.default, |
||
| 42 | ), |
||
| 68 |