| Total Complexity | 4 |
| Total Lines | 17 |
| Duplicated Lines | 94.12 % |
| Coverage | 55.56% |
| Changes | 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 | # Tipos de pergamino |
||
| 3 | 1 | class Pergamino < Util |
|
| 4 | 1 | def name |
|
| 5 | pergamino(id)['name'] |
||
| 6 | end |
||
| 7 | |||
| 8 | 1 | def precio |
|
| 9 | pergamino(id)['precio'] |
||
| 10 | end |
||
| 11 | |||
| 12 | 1 | def max # Max num. permitido |
|
| 13 | pergamino(id)['hechizos'] |
||
| 14 | end |
||
| 15 | |||
| 16 | 1 | def hechizos |
|
| 17 | spells.map { |s| Elemental.new(id: s).name } |
||
| 18 | end |
||
| 19 | end |
||
| 20 |