Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scaffolding generations #138820

Merged
merged 2 commits into from
Feb 19, 2025
Merged

Conversation

stevenh
Copy link
Contributor

@stevenh stevenh commented Feb 18, 2025

Proposed change

Fix script.scaffold generation which is not integration for example config_flow which was failing due to hassfest quality check.

Fix config_flow_helper which would generate out of order manifest keys due to lack of sorting.

This moves the sort_manifest from to script.util as it's now used in multiple scripts.

This updates all flows to pass the integration path to hassfest, so it only checks the integration it's working on and skips the quality check which will fail on newly integrations.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

This fixes the issue flagged by @balloob here

I've tested that all templates for script.scaffold successfully generate a new integration without error.

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@stevenh stevenh requested a review from a team as a code owner February 18, 2025 22:42
@home-assistant home-assistant bot added bugfix cla-signed small-pr PRs with less than 30 lines. labels Feb 18, 2025
@stevenh
Copy link
Contributor Author

stevenh commented Feb 18, 2025

@balloob here's the fix for the additional issue you mentioned on my previous PR

@stevenh stevenh force-pushed the fix/scaffold-config-flow branch from 9a0fdb1 to 2b32b54 Compare February 18, 2025 22:45
@stevenh stevenh force-pushed the fix/scaffold-config-flow branch from 05e07b9 to f449e38 Compare February 19, 2025 10:59
Fix `script.scaffold` generation which is not `integration` for example
`config_flow` which was failing due to hassfest quality check.

Fix `config_flow_helper` which would generate out of order manifest
keys due to lack of sorting.

This moves the `sort_manifest`` from to `script.util` as it's now used
in multiple scripts.

This updates all flows to pass the integration path to hassfest, so it
only checks the integration it's working on and skips the quality check
which will fail on newly integrations.

If a sub process fails during the generation, it will now report and
instruct the user to take action.
@stevenh stevenh force-pushed the fix/scaffold-config-flow branch from f449e38 to 8b4228a Compare February 19, 2025 11:02
@MartinHjelmare
Copy link
Member

For the future, please don't squash or amend commits after review has started to make it easier for readers to track changes.

@stevenh
Copy link
Contributor Author

stevenh commented Feb 19, 2025

For the future, please don't squash or amend commits after review has started to make it easier for readers to track changes.

Thanks for info, different teams work differently 😄

Do you prefer merge commits or Update branch from the github UI?

Any other preferences I can read up on?

@MartinHjelmare
Copy link
Member

Rebasing and merging, to update the branch, are both ok, but I think most people prefer merge since history isn't lost. We'll squash when merging the PR, so it doesn't matter for the result in the target branch. It's fine to press the update branch button in the GitHub web UI.

Improve the logging of the scaffold script to make it easier to debug
problems with the script, this now includes details of each subcommand
that is run.
@frenck frenck merged commit 4ed4c2c into home-assistant:dev Feb 19, 2025
46 checks passed
@stevenh stevenh deleted the fix/scaffold-config-flow branch February 20, 2025 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix cla-signed small-pr PRs with less than 30 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants