lint: Prevent self: Any annotations.

We should omit these for mypy.  For most class definitions,
mypy doesn't need `Any`, and it provides no real useful info.

For clever monkeypatches, you should provide a more specific
type than `Any`.
This commit is contained in:
Steve Howell
2017-12-08 08:03:58 -08:00
committed by Greg Price
parent ac48772907
commit 738c73f08e
3 changed files with 6 additions and 2 deletions

View File

@@ -264,6 +264,10 @@ def build_custom_checkers(by_lang):
'description': 'Missing space around "%"',
'good_lines': ["'%s' % ('foo')", "'%s' % (foo)"],
'bad_lines': ["'%s'%('foo')", "'%s'%(foo)"]},
{'pattern': 'self: Any',
'description': 'you can omit Any annotation for self',
'good_lines': ['def foo (self):'],
'bad_lines': ['def foo(self: Any):']},
# This rule is constructed with + to avoid triggering on itself
{'pattern': " =" + '[^ =>~"]',
'description': 'Missing whitespace after "="',