Skip to content

Improve code quality in sql integration#71705

Merged
bdraco merged 3 commits intohome-assistant:devfrom
gjohansson-ST:sql_clean
May 12, 2022
Merged

Improve code quality in sql integration#71705
bdraco merged 3 commits intohome-assistant:devfrom
gjohansson-ST:sql_clean

Conversation

@gjohansson-ST
Copy link
Copy Markdown
Member

Proposed change

Code clean
Partly from late review comments in #68700

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)
  • 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
  • The code has been formatted using Black (black --fast 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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link
Copy Markdown

Hey there @dgomes, mind taking a look at this pull request as it has been labeled with an integration (sql) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@bdraco
Copy link
Copy Markdown
Member

bdraco commented May 11, 2022

I haven't had a moment to investigate but I did see this post today

https://community.home-assistant.io/t/2022-5-streamlining-settings/418477/438?u=bdraco

Not sure if we need to do a patch for 2022.5

@gjohansson-ST
Copy link
Copy Markdown
Member Author

Tried to replicate with your patch that went into .3 and impossible so my only guess he came from one of the prior 2022.5 versions which had the issue.

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Thanks!

@MartinHjelmare
Copy link
Copy Markdown
Member

Should we merge here or wait for another fix PR to avoid conflicts?

@gjohansson-ST
Copy link
Copy Markdown
Member Author

Could be perhaps good to wait but not sure given we merged this in between #71532
@bdraco ?

@bdraco
Copy link
Copy Markdown
Member

bdraco commented May 12, 2022

Do we want to do a change to add the missing CONF_NAME to the config entry options for the user that modified their options on .0, .1, and .2? Editing and saving the options flow also fixes it since it restores the name after the fix in .3 so it might not be worth it as it required user interaction to get it into the broken state so they likely know about the issue and have already resolved it after upgrading to .3 or by other means.

Even if we plan on doing a patch for that, I don't think it will conflict, so I think we can merge this now.

---references---

#71631 (comment)

Also the automatically created sensor from the old YAML code gives an error:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/sql/sensor.py", line 97, in async_setup_entry
name: str = entry.options[CONF_NAME]
KeyError: 'name'

@bdraco bdraco merged commit a746d7c into home-assistant:dev May 12, 2022
@gjohansson-ST gjohansson-ST deleted the sql_clean branch May 13, 2022 05:05
@github-actions github-actions bot locked and limited conversation to collaborators May 14, 2022
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.

5 participants