Pylint plugin to check that relative imports are used (#50937)

* Pylint plugin to check that relative imports are used

* Fix existing sites

* Update description message

* Fix typo
This commit is contained in:
Ruslan Sayfutdinov 2021-05-22 09:15:30 +01:00 committed by GitHub
parent b704f0e729
commit 016abda12e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 89 additions and 44 deletions

View file

@ -1,5 +1,5 @@
"""Plugin for constructor definitions."""
from astroid import ClassDef, Const, FunctionDef
from astroid import Const, FunctionDef
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter
@ -43,7 +43,7 @@ class HassConstructorFormatChecker(BaseChecker): # type: ignore[misc]
return
# Check that return type is specified and it is "None".
if not isinstance(node.returns, Const) or node.returns.value != None:
if not isinstance(node.returns, Const) or node.returns.value is not None:
self.add_message("hass-constructor-return", node=node)