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

Improve reading clarity of steps code in scripts helper #134395

Merged

Conversation

arturpragacz
Copy link
Contributor

@arturpragacz arturpragacz commented Jan 1, 2025

Proposed change

Improve reading clarity of steps code in scripts helper.
No significant code changes, just reorganizing code to group it more logically and make it easier to read.

The only changes made are:

  • the steps are grouped logically together
  • helper functions are next to where they are used now
  • the step function names now always start with async_step_
  • the steps inside groups are ordered alphabetically

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 PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

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:

@arturpragacz arturpragacz requested a review from a team as a code owner January 1, 2025 16:23
@arturpragacz arturpragacz force-pushed the helpers/script-reorder-steps-code branch from b48acf1 to a5ed0a7 Compare January 24, 2025 19:41
@arturpragacz arturpragacz force-pushed the helpers/script-reorder-steps-code branch 4 times, most recently from de9c9b3 to a0e0980 Compare February 9, 2025 07:45
@arturpragacz arturpragacz changed the title Reorder steps code in scripts helper Improve reading clarity of steps code in scripts helper Feb 9, 2025
@arturpragacz arturpragacz force-pushed the helpers/script-reorder-steps-code branch from a0e0980 to fa5f644 Compare February 10, 2025 16:31
@CloCkWeRX
Copy link
Contributor

This probably is better/nicer; it's just very difficult to review in either split or unified diff format; or by viewing the interim steps (moving one or two chunks at a time).

@arturpragacz
Copy link
Contributor Author

For reviewing I'd suggest clicking on View file and simply looking at the new file.

@bdraco
Copy link
Member

bdraco commented Feb 15, 2025

This probably is better/nicer; it's just very difficult to review in either split or unified diff format; or by viewing the interim steps (moving one or two chunks at a time).

I agree that is difficult to see what has changed. It would be nicer to do this in a few smaller merges and only rearrange the location of one function per merge so the changes can easily be seen.

@arturpragacz
Copy link
Contributor Author

This probably is better/nicer; it's just very difficult to review in either split or unified diff format; or by viewing the interim steps (moving one or two chunks at a time).

I agree that is difficult to see what has changed. It would be nicer to do this in a few smaller merges and only rearrange the location of one function per merge so the changes can easily be seen.

I think splitting is a good idea, but going only one function per PR would be overkill.

Here's part 1: #138628

@bdraco
Copy link
Member

bdraco commented Feb 16, 2025

The advantage to one per function is I can review it on my mobile and check it in my head vs waiting to have a time chunk at my desk which is much more of a premium. Either way we can get it merged eventually, it will take longer to review if I can't do it mobile

@bdraco
Copy link
Member

bdraco commented Feb 19, 2025

I think splitting is a good idea, but going only one function per PR would be overkill.

Here's part 1: #138628

I checked each relocation manually, and merged that one so hopefully this one will be a bit smaller once rebased

@arturpragacz arturpragacz force-pushed the helpers/script-reorder-steps-code branch from d59f19b to 75a4672 Compare February 19, 2025 17:24
Copy link
Contributor

@emontnemery emontnemery left a comment

Choose a reason for hiding this comment

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

Looks good. I've checked each moved block manually.

@emontnemery emontnemery merged commit 7117708 into home-assistant:dev Feb 19, 2025
46 checks passed
@arturpragacz arturpragacz deleted the helpers/script-reorder-steps-code branch February 19, 2025 18:44
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants