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

SectionNode.get_command()   A

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 5
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 2
dl 5
loc 5
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nop 1
crap 2
1
from typing import Dict
2
3
from cleo.styles import OutputStyle
4
5
from sdoc.sdoc2.node.HeadingNode import HeadingNode
6
from sdoc.sdoc2.NodeStore import NodeStore
7
8
9 View Code Duplication
class SectionNode(HeadingNode):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10
    """
11
    SDoc2 node for sections.
12
    """
13
14
    # ------------------------------------------------------------------------------------------------------------------
15
    def __init__(self, io: OutputStyle, options: Dict[str, str], argument: str):
16
        """
17
        Object constructor.
18
19
        :param OutputStyle io: The IO object.
20
        :param dict[str,str] options: The options of this section.
21
        :param str argument: The title of this section.
22
        """
23
        super().__init__(io, 'section', options, argument)
24
25
    # ------------------------------------------------------------------------------------------------------------------
26
    def get_command(self) -> str:
27
        """
28
        Returns the command of this node, i.e. section.
29
        """
30
        return 'section'
31
32
    # ------------------------------------------------------------------------------------------------------------------
33
    def get_hierarchy_level(self, parent_hierarchy_level: int = -1) -> int:
34
        """
35
        Returns 2.
36
        """
37
        return 2
38
39
40
# ----------------------------------------------------------------------------------------------------------------------
41
NodeStore.register_inline_command('section', SectionNode)
42