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

OneToOneFieldChecker.visit_attribute()   A

Complexity

Conditions 2

Size

Total Lines 4
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 2
nop 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