Total Complexity | 1 |
Total Lines | 26 |
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 |
||
14 | 1 | View Code Duplication | @zope.interface.implementer(INISerializable) |
|
|||
15 | 1 | class Anticheat(Model): |
|
16 | 1 | version_check_level = IntType( |
|
17 | min_value=0, |
||
18 | max_value=2, |
||
19 | default=0, |
||
20 | required=True, |
||
21 | ) |
||
22 | 1 | lags = ModelType( |
|
23 | model_spec=Lags, |
||
24 | required=True, |
||
25 | ) |
||
26 | 1 | speedhack = ModelType( |
|
27 | model_spec=Speedhack, |
||
28 | required=True, |
||
29 | ) |
||
30 | |||
31 | 1 | @classmethod |
|
32 | def from_ini(cls, ini): |
||
33 | return cls({ |
||
34 | 'version_check_level': ini.getint( |
||
35 | 'NET', 'checkRuntime', |
||
36 | fallback=cls.version_check_level.default, |
||
37 | ), |
||
38 | 'lags': Lags.from_ini(ini), |
||
39 | 'speedhack': Speedhack.from_ini(ini), |
||
40 | }) |
||
41 |