Total Complexity | 2 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |