Skip to content

Commit

Permalink
Update pylint to 2.14.0 (home-assistant#73119)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Jun 6, 2022
1 parent ed54cea commit 983a76a
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 25 deletions.
2 changes: 2 additions & 0 deletions homeassistant/components/hassio/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

MAX_UPLOAD_SIZE = 1024 * 1024 * 1024

# pylint: disable=implicit-str-concat
NO_TIMEOUT = re.compile(
r"^(?:"
r"|homeassistant/update"
Expand All @@ -48,6 +49,7 @@
)

NO_STORE = re.compile(r"^(?:" r"|app/entrypoint.js" r")$")
# pylint: enable=implicit-str-concat


class HassIOView(HomeAssistantView):
Expand Down
2 changes: 2 additions & 0 deletions homeassistant/components/hassio/websocket_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
)

# 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(
r"^(?:" r"|/ingress/(session|validate_session)" r"|/addons/[^/]+/info" r")$"
)
# pylint: enable=implicit-str-concat

_LOGGER: logging.Logger = logging.getLogger(__package__)

Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/sentry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
),
}

# pylint: disable-next=abstract-class-instantiated
sentry_sdk.init(
dsn=entry.data[CONF_DSN],
environment=entry.options.get(CONF_ENVIRONMENT),
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/helpers/update_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from datetime import datetime, timedelta
import logging
from time import monotonic
from typing import Any, Generic, TypeVar # pylint: disable=unused-import
from typing import Any, Generic, TypeVar
import urllib.error

import aiohttp
Expand Down
5 changes: 1 addition & 4 deletions pylint/plugins/hass_constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@

from astroid import nodes
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter


class HassConstructorFormatChecker(BaseChecker): # type: ignore[misc]
"""Checker for __init__ definitions."""

__implements__ = IAstroidChecker

name = "hass_constructor"
priority = -1
msgs = {
"W0006": (
"W7411": (
'__init__ should have explicit return type "None"',
"hass-constructor-return",
"Used when __init__ has all arguments typed "
Expand Down
7 changes: 2 additions & 5 deletions pylint/plugins/hass_enforce_type_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from astroid import nodes
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter

from homeassistant.const import Platform
Expand Down Expand Up @@ -540,17 +539,15 @@ def _get_module_platform(module_name: str) -> str | None:
class HassTypeHintChecker(BaseChecker): # type: ignore[misc]
"""Checker for setup type hints."""

__implements__ = IAstroidChecker

name = "hass_enforce_type_hints"
priority = -1
msgs = {
"W0020": (
"W7431": (
"Argument %d should be of type %s",
"hass-argument-type",
"Used when method argument type is incorrect",
),
"W0021": (
"W7432": (
"Return type should be %s",
"hass-return-type",
"Used when method return type is incorrect",
Expand Down
7 changes: 2 additions & 5 deletions pylint/plugins/hass_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from astroid import nodes
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter


Expand Down Expand Up @@ -233,17 +232,15 @@ class ObsoleteImportMatch:
class HassImportsFormatChecker(BaseChecker): # type: ignore[misc]
"""Checker for imports."""

__implements__ = IAstroidChecker

name = "hass_imports"
priority = -1
msgs = {
"W0011": (
"W7421": (
"Relative import should be used",
"hass-relative-import",
"Used when absolute import should be replaced with relative import",
),
"W0012": (
"W7422": (
"%s is deprecated, %s",
"hass-deprecated-import",
"Used when import is deprecated",
Expand Down
7 changes: 2 additions & 5 deletions pylint/plugins/hass_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

from astroid import nodes
from pylint.checkers import BaseChecker
from pylint.interfaces import IAstroidChecker
from pylint.lint import PyLinter

LOGGER_NAMES = ("LOGGER", "_LOGGER")
Expand All @@ -13,17 +12,15 @@
class HassLoggerFormatChecker(BaseChecker): # type: ignore[misc]
"""Checker for logger invocations."""

__implements__ = IAstroidChecker

name = "hass_logger"
priority = -1
msgs = {
"W0001": (
"W7401": (
"User visible logger messages must not end with a period",
"hass-logger-period",
"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",
"hass-logger-capital",
"All logger messages must start with a capital letter",
Expand Down
4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ forced_separate = [
]
combine_as_imports = true

[tool.pylint.MASTER]
[tool.pylint.MAIN]
py-version = "3.9"
ignore = [
"tests",
Expand Down Expand Up @@ -152,7 +152,6 @@ good-names = [
# too-many-ancestors - it's too strict.
# wrong-import-order - isort guards this
# 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:
# consider-using-namedtuple-or-dataclass (Pylint CodeStyle extension)
Expand All @@ -179,7 +178,6 @@ disable = [
"unused-argument",
"wrong-import-order",
"consider-using-f-string",
"no-self-use",
"consider-using-namedtuple-or-dataclass",
"consider-using-assignment-expr",
]
Expand Down
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ freezegun==1.2.1
mock-open==1.4.0
mypy==0.960
pre-commit==2.19.0
pylint==2.13.9
pylint==2.14.0
pipdeptree==2.2.1
pylint-strict-informational==0.1
pytest-aiohttp==0.3.0
Expand Down

0 comments on commit 983a76a

Please sign in to comment.