Passed
Push — master ( c24a70...6ad542 )
by P.R.
11:00
created

etlt.condition.SimpleCondition   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 90.48 %

Test Coverage

Coverage 93.75%

Importance

Changes 0
Metric Value
eloc 17
dl 57
loc 63
ccs 15
cts 16
cp 0.9375
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A SimpleCondition.expression() 8 8 1
A SimpleCondition.field() 8 8 1
A SimpleCondition.scheme() 9 9 1
A SimpleCondition.__init__() 16 16 1

How to fix   Duplicated Code   

Duplicated Code

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
import abc
2
3 1
from etlt.condition.Condition import Condition
4
5
6 1 View Code Duplication
class SimpleCondition(Condition):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7
    """
8
    A simple condition matches a single field in the row against an expression.
9
    """
10
11
    # ------------------------------------------------------------------------------------------------------------------
12 1
    def __init__(self, field, expression):
13
        """
14
        Object contructor.
15
16
        :param str field: The name of the field in the row that must be match against the expression.
17
        :param str expression: The expression.
18
        """
19 1
        self._field = field
20
        """
21
        The name of the field in the row that must be match against the expression.
22
23
        :type: str
24
        """
25
26 1
        self._expression = expression
27 1
        """
28
        The expression.
29
30
        :type: str
31
        """
32
33
    # ------------------------------------------------------------------------------------------------------------------
34 1
    @property
35 1
    def expression(self):
36
        """
37
        Returns the expression.
38
39
        :rtype: str
40
        """
41 1
        return self._expression
42
43
    # ------------------------------------------------------------------------------------------------------------------
44 1
    @property
45 1
    def field(self):
46
        """
47
        Returns the name of the field in the row that must be match against the expression.
48
49
        :rtype: str
50
        """
51
        return self._field
52
53
    # ------------------------------------------------------------------------------------------------------------------
54 1
    @property
55 1
    @abc.abstractmethod
56 1
    def scheme(self):
57
        """
58
        Returns the scheme of the simple condition.
59
60
        :rtype: str
61
        """
62
        raise NotImplementedError()
63
64
# ----------------------------------------------------------------------------------------------------------------------
65