Passed
Push — master ( 01c2a7...43572e )
by Alexander
02:17
created

kiwi_lint.one_to_one_field   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 14
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A OneToOneFieldChecker.visit_attribute() 0 4 2
1
from pylint import interfaces
2
from pylint import checkers
3
from pylint.checkers import utils
4
5
6
class OneToOneFieldChecker(checkers.BaseChecker):
7
    __implements__ = (interfaces.IAstroidChecker,)
8
9
    name = 'one-to-one-field-checker'
10
11
    msgs = {'R4531': ("Do not use OneToOneField",
12
                      'one-to-one-field',
13
                      "Do not use OneToOneField because it does not play well with the"
14
                      "history framework (this relation does not have enabled history")}
15
16
    @utils.check_messages('one-to-one-field')
17
    def visit_attribute(self, node):
18
        if node.attrname == 'OneToOneField':
19
            self.add_message('one-to-one-field', node=node)
20