Passed
Push — master ( 4cb748...589c2a )
by P.R.
01:36
created

sdoc.command.BaseCommand.BaseCommand.__set_style()   A

Complexity

Conditions 1

Size

Total Lines 15
Code Lines 5

Duplication

Lines 15
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 5
dl 15
loc 15
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
cc 1
nop 1
crap 1
1 1
from abc import ABC
2
3 1
from cleo.commands.command import Command
4
5
6 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...
7
    """
8
    Abstract parent command for all out commands.
9
    """
10
11
    # ------------------------------------------------------------------------------------------------------------------
12 1
    def __set_style(self):
13
        """
14
        Sets the output format style used by SDoc.
15
        """
16
        # Style for file system objects (e.g. file and directory names).
17 1
        self.add_style('fso', fg='green', options=['bold'])
18
19
        # Style for errors.
20 1
        self.add_style('error', fg='red', options=['bold'])
21
22
        # Style for SDoc notices.
23 1
        self.add_style('notice', fg='yellow')
24
25
        # Style for titles.
26 1
        self.add_style('title', fg='yellow')
27
28
    # ------------------------------------------------------------------------------------------------------------------
29 1
    def _handle(self) -> int:
30
        """
31
        Executes this command.
32
        """
33
        raise NotImplementedError()
34
35
    # ------------------------------------------------------------------------------------------------------------------
36 1
    def handle(self) -> int:
37
        """
38
        Executes this command.
39
        """
40 1
        self.__set_style()
41
42 1
        return self._handle()
43
44
# ----------------------------------------------------------------------------------------------------------------------
45