Prevent wilcard coverage ignore if tests exist (#86455)

This commit is contained in:
epenet 2023-01-23 16:33:57 +01:00 committed by GitHub
parent 33fb27eb1a
commit 15ab04f97d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 15 deletions

View file

@ -50,7 +50,6 @@ ALLOWED_IGNORE_VIOLATIONS = {
("sonos", "diagnostics.py"),
("stookalert", "diagnostics.py"),
("stookwijzer", "diagnostics.py"),
("stream", "diagnostics.py"),
("synology_dsm", "diagnostics.py"),
("system_bridge", "media_source.py"),
("tractive", "diagnostics.py"),
@ -108,6 +107,15 @@ def validate(integrations: dict[str, Integration], config: Config) -> None:
integration = integrations[integration_path.name]
if (
path.parts[-1] == "*"
and Path(f"tests/components/{integration.domain}/__init__.py").exists()
):
integration.add_error(
"coverage",
"has tests and should not use wildcard in .coveragerc file",
)
for check in DONT_IGNORE:
if path.parts[-1] not in {"*", check}:
continue