Total Complexity | 2 |
Total Lines | 29 |
Duplicated Lines | 100 % |
Coverage | 77.78% |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
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 |
||
55 | 1 | View Code Duplication | @zope.interface.implementer(INISerializable) |
|
|||
56 | 1 | @zope.interface.implementer(DefaultProvider) |
|
57 | 1 | class Events(Model): |
|
58 | 1 | chat_level = IntType( |
|
59 | min_value=0, |
||
60 | max_value=3, |
||
61 | default=0, |
||
62 | required=True, |
||
63 | ) |
||
64 | 1 | logging = ModelType( |
|
65 | model_spec=Logging, |
||
66 | required=True, |
||
67 | ) |
||
68 | |||
69 | 1 | @classmethod |
|
70 | def from_ini(cls, ini): |
||
71 | return cls({ |
||
72 | 'chat_level': field_from_ini( |
||
73 | cls.chat_level, ini, |
||
74 | 'chat', 'autoLogDetail', |
||
75 | ), |
||
76 | 'logging': Logging.from_ini(ini), |
||
77 | }) |
||
78 | |||
79 | 1 | @classmethod |
|
80 | def default(cls): |
||
81 | return cls({ |
||
82 | 'chat_level': cls.chat_level.default, |
||
83 | 'logging': Logging.default(), |
||
84 | }) |
||
85 |