mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +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: |
|
||||
. venv/bin/activate
|
||||
python --version
|
||||
pylint homeassistant
|
||||
pylint --ignore-missing-annotations=y homeassistant
|
||||
- name: Run pylint (partially)
|
||||
if: needs.changes.outputs.test_full_suite == 'false'
|
||||
shell: bash
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
python --version
|
||||
pylint homeassistant/components/${{ needs.changes.outputs.integrations_glob }}
|
||||
pylint --ignore-missing-annotations=y homeassistant/components/${{ needs.changes.outputs.integrations_glob }}
|
||||
|
||||
mypy:
|
||||
name: Check mypy
|
||||
|
@ -96,7 +96,7 @@ repos:
|
||||
files: ^(homeassistant|pylint)/.+\.py$
|
||||
- id: 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
|
||||
types: [python]
|
||||
files: ^homeassistant/.+\.py$
|
||||
|
@ -1268,7 +1268,7 @@ class HassTypeHintChecker(BaseChecker): # type: ignore[misc]
|
||||
(
|
||||
"ignore-missing-annotations",
|
||||
{
|
||||
"default": True,
|
||||
"default": False,
|
||||
"type": "yn",
|
||||
"metavar": "<y or n>",
|
||||
"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
|
||||
) -> None:
|
||||
"""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(
|
||||
code,
|
||||
"homeassistant.components.pylint_test",
|
||||
@ -539,6 +542,9 @@ def test_ignore_invalid_entity_properties(
|
||||
linter: UnittestLinter, type_hint_checker: BaseChecker
|
||||
) -> None:
|
||||
"""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 LockEntity():
|
||||
|
Loading…
x
Reference in New Issue
Block a user