Update pylint to 2.14.0 (#73119)

This commit is contained in:
Marc Mueller 2022-06-06 21:43:47 +02:00 committed by GitHub
parent ed54cea3f2
commit 983a76a91c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 14 additions and 25 deletions

View file

@ -28,6 +28,7 @@ _LOGGER = logging.getLogger(__name__)
MAX_UPLOAD_SIZE = 1024 * 1024 * 1024 MAX_UPLOAD_SIZE = 1024 * 1024 * 1024
# pylint: disable=implicit-str-concat
NO_TIMEOUT = re.compile( NO_TIMEOUT = re.compile(
r"^(?:" r"^(?:"
r"|homeassistant/update" r"|homeassistant/update"
@ -48,6 +49,7 @@ NO_AUTH = re.compile(
) )
NO_STORE = re.compile(r"^(?:" r"|app/entrypoint.js" r")$") NO_STORE = re.compile(r"^(?:" r"|app/entrypoint.js" r")$")
# pylint: enable=implicit-str-concat
class HassIOView(HomeAssistantView): class HassIOView(HomeAssistantView):

View file

@ -38,9 +38,11 @@ SCHEMA_WEBSOCKET_EVENT = vol.Schema(
) )
# Endpoints needed for ingress can't require admin because addons can set `panel_admin: false` # Endpoints needed for ingress can't require admin because addons can set `panel_admin: false`
# pylint: disable=implicit-str-concat
WS_NO_ADMIN_ENDPOINTS = re.compile( WS_NO_ADMIN_ENDPOINTS = re.compile(
r"^(?:" r"|/ingress/(session|validate_session)" r"|/addons/[^/]+/info" r")$" r"^(?:" r"|/ingress/(session|validate_session)" r"|/addons/[^/]+/info" r")$"
) )
# pylint: enable=implicit-str-concat
_LOGGER: logging.Logger = logging.getLogger(__package__) _LOGGER: logging.Logger = logging.getLogger(__package__)

View file

@ -80,7 +80,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
), ),
} }
# pylint: disable-next=abstract-class-instantiated
sentry_sdk.init( sentry_sdk.init(
dsn=entry.data[CONF_DSN], dsn=entry.data[CONF_DSN],
environment=entry.options.get(CONF_ENVIRONMENT), environment=entry.options.get(CONF_ENVIRONMENT),

View file

@ -6,7 +6,7 @@ from collections.abc import Awaitable, Callable, Generator
from datetime import datetime, timedelta from datetime import datetime, timedelta
import logging import logging
from time import monotonic from time import monotonic
from typing import Any, Generic, TypeVar # pylint: disable=unused-import from typing import Any, Generic, TypeVar
import urllib.error import urllib.error
import aiohttp import aiohttp

View file

@ -3,19 +3,16 @@ from __future__ import annotations
from astroid import nodes from astroid import nodes
from pylint.checkers import BaseChecker from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter from pylint.lint import PyLinter
class HassConstructorFormatChecker(BaseChecker): # type: ignore[misc] class HassConstructorFormatChecker(BaseChecker): # type: ignore[misc]
"""Checker for __init__ definitions.""" """Checker for __init__ definitions."""
__implements__ = IAstroidChecker
name = "hass_constructor" name = "hass_constructor"
priority = -1 priority = -1
msgs = { msgs = {
"W0006": ( "W7411": (
'__init__ should have explicit return type "None"', '__init__ should have explicit return type "None"',
"hass-constructor-return", "hass-constructor-return",
"Used when __init__ has all arguments typed " "Used when __init__ has all arguments typed "

View file

@ -6,7 +6,6 @@ import re
from astroid import nodes from astroid import nodes
from pylint.checkers import BaseChecker from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter from pylint.lint import PyLinter
from homeassistant.const import Platform from homeassistant.const import Platform
@ -540,17 +539,15 @@ def _get_module_platform(module_name: str) -> str | None:
class HassTypeHintChecker(BaseChecker): # type: ignore[misc] class HassTypeHintChecker(BaseChecker): # type: ignore[misc]
"""Checker for setup type hints.""" """Checker for setup type hints."""
__implements__ = IAstroidChecker
name = "hass_enforce_type_hints" name = "hass_enforce_type_hints"
priority = -1 priority = -1
msgs = { msgs = {
"W0020": ( "W7431": (
"Argument %d should be of type %s", "Argument %d should be of type %s",
"hass-argument-type", "hass-argument-type",
"Used when method argument type is incorrect", "Used when method argument type is incorrect",
), ),
"W0021": ( "W7432": (
"Return type should be %s", "Return type should be %s",
"hass-return-type", "hass-return-type",
"Used when method return type is incorrect", "Used when method return type is incorrect",

View file

@ -6,7 +6,6 @@ import re
from astroid import nodes from astroid import nodes
from pylint.checkers import BaseChecker from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter from pylint.lint import PyLinter
@ -233,17 +232,15 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
class HassImportsFormatChecker(BaseChecker): # type: ignore[misc] class HassImportsFormatChecker(BaseChecker): # type: ignore[misc]
"""Checker for imports.""" """Checker for imports."""
__implements__ = IAstroidChecker
name = "hass_imports" name = "hass_imports"
priority = -1 priority = -1
msgs = { msgs = {
"W0011": ( "W7421": (
"Relative import should be used", "Relative import should be used",
"hass-relative-import", "hass-relative-import",
"Used when absolute import should be replaced with relative import", "Used when absolute import should be replaced with relative import",
), ),
"W0012": ( "W7422": (
"%s is deprecated, %s", "%s is deprecated, %s",
"hass-deprecated-import", "hass-deprecated-import",
"Used when import is deprecated", "Used when import is deprecated",

View file

@ -3,7 +3,6 @@ from __future__ import annotations
from astroid import nodes from astroid import nodes
from pylint.checkers import BaseChecker from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter from pylint.lint import PyLinter
LOGGER_NAMES = ("LOGGER", "_LOGGER") LOGGER_NAMES = ("LOGGER", "_LOGGER")
@ -13,17 +12,15 @@ LOG_LEVEL_ALLOWED_LOWER_START = ("debug",)
class HassLoggerFormatChecker(BaseChecker): # type: ignore[misc] class HassLoggerFormatChecker(BaseChecker): # type: ignore[misc]
"""Checker for logger invocations.""" """Checker for logger invocations."""
__implements__ = IAstroidChecker
name = "hass_logger" name = "hass_logger"
priority = -1 priority = -1
msgs = { msgs = {
"W0001": ( "W7401": (
"User visible logger messages must not end with a period", "User visible logger messages must not end with a period",
"hass-logger-period", "hass-logger-period",
"Periods are not permitted at the end of logger messages", "Periods are not permitted at the end of logger messages",
), ),
"W0002": ( "W7402": (
"User visible logger messages must start with a capital letter or downgrade to debug", "User visible logger messages must start with a capital letter or downgrade to debug",
"hass-logger-capital", "hass-logger-capital",
"All logger messages must start with a capital letter", "All logger messages must start with a capital letter",

View file

@ -87,7 +87,7 @@ forced_separate = [
] ]
combine_as_imports = true combine_as_imports = true
[tool.pylint.MASTER] [tool.pylint.MAIN]
py-version = "3.9" py-version = "3.9"
ignore = [ ignore = [
"tests", "tests",
@ -152,7 +152,6 @@ good-names = [
# too-many-ancestors - it's too strict. # too-many-ancestors - it's too strict.
# wrong-import-order - isort guards this # wrong-import-order - isort guards this
# consider-using-f-string - str.format sometimes more readable # consider-using-f-string - str.format sometimes more readable
# no-self-use - little added value with too many false-positives
# --- # ---
# Enable once current issues are fixed: # Enable once current issues are fixed:
# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension) # consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension)
@ -179,7 +178,6 @@ disable = [
"unused-argument", "unused-argument",
"wrong-import-order", "wrong-import-order",
"consider-using-f-string", "consider-using-f-string",
"no-self-use",
"consider-using-namedtuple-or-dataclass", "consider-using-namedtuple-or-dataclass",
"consider-using-assignment-expr", "consider-using-assignment-expr",
] ]

View file

@ -13,7 +13,7 @@ freezegun==1.2.1
mock-open==1.4.0 mock-open==1.4.0
mypy==0.960 mypy==0.960
pre-commit==2.19.0 pre-commit==2.19.0
pylint==2.13.9 pylint==2.14.0
pipdeptree==2.2.1 pipdeptree==2.2.1
pylint-strict-informational==0.1 pylint-strict-informational==0.1
pytest-aiohttp==0.3.0 pytest-aiohttp==0.3.0