Test Failed
Push — master ( 714282...4cb748 )
by P.R.
01:55 queued 13s
created

sdoc.command.BaseCommand.BaseCommand.__init__()   A

Complexity

Conditions 1

Size

Total Lines 7
Code Lines 2

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 7
loc 7
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nop 2
crap 2
1
from abc import ABC
2
3
from cleo import Command
4
from cleo.styles import CleoStyle
5
6
7 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
    def __init__(self, name=None):
14
        """
15
        Object constructor.
16
17
        :param str|None name: The name of the command.
18
        """
19
        Command.__init__(self, name)
20
21
    # ------------------------------------------------------------------------------------------------------------------
22
    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
        self.set_style('fso', fg='green', options=['bold'])
28
29
        # Style for errors.
30
        self.set_style('error', fg='red', options=['bold'])
31
32
        # Style for SDoc1 notices.
33
        self.set_style('notice', fg='yellow')
34
35
    # ------------------------------------------------------------------------------------------------------------------
36
    def execute(self, i, o):
37
        self.input = i
38
        self.output = o
39
40
        self.__set_style()
41
        self.output = CleoStyle(self.input, self.output)
42
43
        return self.handle()
44
45
# ----------------------------------------------------------------------------------------------------------------------
46