Passed
Push — master ( 8ff2fc...2dab2b )
by P.R.
04:18 queued 10s
created

sdoc.command.BaseCommand.BaseCommand.execute()   A

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 6
dl 8
loc 8
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nop 3
crap 1
1 1
from abc import ABC
2
3 1
from cleo import Command
4 1
from cleo.styles import CleoStyle
5
6
7 1 View Code Duplication
class BaseCommand(Command, ABC):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
8
    """
9
    Abstract parent command for all out commands.
10
    """
11
12
    # ------------------------------------------------------------------------------------------------------------------
13 1
    def __init__(self, name=None):
14
        """
15
        Object constructor.
16
17
        :param str|None name: The name of the command.
18
        """
19 1
        Command.__init__(self, name)
20
21
    # ------------------------------------------------------------------------------------------------------------------
22 1
    def __set_style(self):
23
        """
24
        Sets the output format style used by SDoc.
25
        """
26
        # Style for file system objects (e.g. file and directory names).
27 1
        self.set_style('fso', fg='green', options=['bold'])
28
29
        # Style for errors.
30 1
        self.set_style('error', fg='red', options=['bold'])
31
32
        # Style for SDoc1 notices.
33 1
        self.set_style('notice', fg='yellow')
34
35
    # ------------------------------------------------------------------------------------------------------------------
36 1
    def execute(self, i, o):
37 1
        self.input = i
38 1
        self.output = o
39
40 1
        self.__set_style()
41 1
        self.output = CleoStyle(self.input, self.output)
42
43 1
        return self.handle()
44
45
# ----------------------------------------------------------------------------------------------------------------------
46