mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Add enforce_type_hints to vscode tasks (#74227)
This commit is contained in:
parent
3899c9e6d3
commit
1bfd8b1a76
4
.github/workflows/ci.yaml
vendored
4
.github/workflows/ci.yaml
vendored
@ -648,14 +648,14 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
python --version
|
python --version
|
||||||
pylint homeassistant
|
pylint --ignore-missing-annotations=y homeassistant
|
||||||
- name: Run pylint (partially)
|
- name: Run pylint (partially)
|
||||||
if: needs.changes.outputs.test_full_suite == 'false'
|
if: needs.changes.outputs.test_full_suite == 'false'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
python --version
|
python --version
|
||||||
pylint homeassistant/components/${{ needs.changes.outputs.integrations_glob }}
|
pylint --ignore-missing-annotations=y homeassistant/components/${{ needs.changes.outputs.integrations_glob }}
|
||||||
|
|
||||||
mypy:
|
mypy:
|
||||||
name: Check mypy
|
name: Check mypy
|
||||||
|
@ -96,7 +96,7 @@ repos:
|
|||||||
files: ^(homeassistant|pylint)/.+\.py$
|
files: ^(homeassistant|pylint)/.+\.py$
|
||||||
- id: pylint
|
- id: pylint
|
||||||
name: pylint
|
name: pylint
|
||||||
entry: script/run-in-env.sh pylint -j 0
|
entry: script/run-in-env.sh pylint -j 0 --ignore-missing-annotations=y
|
||||||
language: script
|
language: script
|
||||||
types: [python]
|
types: [python]
|
||||||
files: ^homeassistant/.+\.py$
|
files: ^homeassistant/.+\.py$
|
||||||
|
@ -1268,7 +1268,7 @@ class HassTypeHintChecker(BaseChecker): # type: ignore[misc]
|
|||||||
(
|
(
|
||||||
"ignore-missing-annotations",
|
"ignore-missing-annotations",
|
||||||
{
|
{
|
||||||
"default": True,
|
"default": False,
|
||||||
"type": "yn",
|
"type": "yn",
|
||||||
"metavar": "<y or n>",
|
"metavar": "<y or n>",
|
||||||
"help": "Set to ``no`` if you wish to check functions that do not "
|
"help": "Set to ``no`` if you wish to check functions that do not "
|
||||||
|
@ -120,6 +120,9 @@ def test_ignore_no_annotations(
|
|||||||
hass_enforce_type_hints: ModuleType, type_hint_checker: BaseChecker, code: str
|
hass_enforce_type_hints: ModuleType, type_hint_checker: BaseChecker, code: str
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Ensure that _is_valid_type is not run if there are no annotations."""
|
"""Ensure that _is_valid_type is not run if there are no annotations."""
|
||||||
|
# Set ignore option
|
||||||
|
type_hint_checker.config.ignore_missing_annotations = True
|
||||||
|
|
||||||
func_node = astroid.extract_node(
|
func_node = astroid.extract_node(
|
||||||
code,
|
code,
|
||||||
"homeassistant.components.pylint_test",
|
"homeassistant.components.pylint_test",
|
||||||
@ -539,6 +542,9 @@ def test_ignore_invalid_entity_properties(
|
|||||||
linter: UnittestLinter, type_hint_checker: BaseChecker
|
linter: UnittestLinter, type_hint_checker: BaseChecker
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Check invalid entity properties are ignored by default."""
|
"""Check invalid entity properties are ignored by default."""
|
||||||
|
# Set ignore option
|
||||||
|
type_hint_checker.config.ignore_missing_annotations = True
|
||||||
|
|
||||||
class_node = astroid.extract_node(
|
class_node = astroid.extract_node(
|
||||||
"""
|
"""
|
||||||
class LockEntity():
|
class LockEntity():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user