Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,9 @@ def gather_files_to_download(self) -> list[FileInformation]:
for release in releaseobjects or []:
if ref == release.tag_name:
for asset in release.assets or []:
# For themes, only download .yaml files from release assets
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation: This line has excessive indentation (appears to have multiple leading spaces beyond what's needed). It should align with the surrounding code at the proper indentation level for code inside the for asset in release.assets or []: loop.

Suggested change
# For themes, only download .yaml files from release assets
# For themes, only download .yaml files from release assets

Copilot uses AI. Check for mistakes.
if category == "theme" and not asset.name.endswith(".yaml"):
continue
files.append(
FileInformation(asset.browser_download_url, asset.name, asset.name)
)
Expand Down
24 changes: 24 additions & 0 deletions tests/helpers/download/test_gather_files_to_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,4 +230,28 @@ def test_gather_plugin_different_card_name(repository_plugin):
repository_plugin.update_filenames()
files = [x.path for x in repository.gather_files_to_download()]
assert "card.js" in files

def test_gather_theme_files_from_release_only_yaml(repository_theme):
"""Test that only .yaml files are downloaded from theme release assets."""
repository = repository_theme
repository.ref = "1.0.0"
Comment on lines +234 to +237
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation: This test function is nested inside test_gather_plugin_different_card_name instead of being at the module level. The def statement should be at the same indentation level as other test functions (no leading spaces), not indented within the previous function.

Suggested change
def test_gather_theme_files_from_release_only_yaml(repository_theme):
"""Test that only .yaml files are downloaded from theme release assets."""
repository = repository_theme
repository.ref = "1.0.0"
def test_gather_theme_files_from_release_only_yaml(repository_theme):
"""Test that only .yaml files are downloaded from theme release assets."""
repository = repository_theme
repository.ref = "1.0.0"

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect indentation: This line has inconsistent indentation compared to the rest of the function body. It should be aligned with line 236 (4 spaces), not 8 spaces.

Suggested change
repository.ref = "1.0.0"
repository.ref = "1.0.0"

Copilot uses AI. Check for mistakes.
Comment on lines +234 to +237
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable test_gather_theme_files_from_release_only_yaml is not used.

Suggested change
def test_gather_theme_files_from_release_only_yaml(repository_theme):
"""Test that only .yaml files are downloaded from theme release assets."""
repository = repository_theme
repository.ref = "1.0.0"
def test_gather_theme_files_from_release_only_yaml(repository_theme):
"""Test that only .yaml files are downloaded from theme release assets."""
repository = repository_theme
repository.ref = "1.0.0"

Copilot uses AI. Check for mistakes.
repository.data.releases = True
repository.releases.objects = [
GitHubReleaseModel({
"tag_name": "1.0.0",
"assets": [
{"name": "theme.yaml"},
{"name": "theme-dark.yaml"},
{"name": "screenshot.png"},
{"name": "README.md"},
{"name": "theme.zip"},
]
}),
]
files = [x.name for x in repository.gather_files_to_download()]
assert "theme.yaml" in files
assert "theme-dark.yaml" in files
assert "screenshot.png" not in files
assert "README.md" not in files
assert "theme.zip" not in files
assert "info.md" not in files