| Total Complexity | 1 |
| Total Lines | 25 |
| Duplicated Lines | 68 % |
| Coverage | 100% |
| 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 | 1 | from cleo.helpers import argument |
|
| 2 | |||
| 3 | 1 | from sdoc.command.BaseCommand import BaseCommand |
|
| 4 | 1 | from sdoc.io.SDocIO import SDocIO |
|
| 5 | 1 | from sdoc.SDoc import SDoc |
|
| 6 | |||
| 7 | |||
| 8 | 1 | View Code Duplication | class SDoc2Command(BaseCommand): |
|
|
|||
| 9 | 1 | name = 'sdoc2' |
|
| 10 | 1 | description = 'Parses a SDoc2 document' |
|
| 11 | 1 | arguments = [argument('config.cfg', description='The name of the config file'), |
|
| 12 | argument('main.sdoc2', description='The SDoc2 document to parse')] |
||
| 13 | |||
| 14 | # ------------------------------------------------------------------------------------------------------------------ |
||
| 15 | 1 | def _handle(self) -> int: |
|
| 16 | """ |
||
| 17 | Reads the arguments and starts SDoc application. |
||
| 18 | """ |
||
| 19 | 1 | sdoc = SDoc() |
|
| 20 | 1 | sdoc.io = SDocIO(self.io.input, self.io.output, self.io.error_output) |
|
| 21 | 1 | sdoc.config_path = self.argument('config.cfg') |
|
| 22 | 1 | sdoc.init() |
|
| 23 | |||
| 24 | 1 | return sdoc.run_sdoc2(self.argument('main.sdoc2')) |
|
| 25 | |||
| 27 |