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

Bump ruff to 0.9.0 #135197

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft

Bump ruff to 0.9.0 #135197

wants to merge 3 commits into from

Conversation

joostlek
Copy link
Member

@joostlek joostlek commented Jan 9, 2025

Proposed change

Bump ruff to 0.9.0
astral-sh/ruff@0.8.6...0.9.0
https://github.com/astral-sh/ruff/releases/tag/0.9.0

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:

Comment on lines -216 to -217
f"{self._device._setpoint_shift.group_address}" # noqa: SLF001
)
Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like a bug in ruff, because the noqa got moved

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

You are faster than me this time 😛 Hmm, with that we will need to wait until 0.9.1, I think 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean, it was a breaking change and it looked like something would change and that sounds interesting :P

Choose a reason for hiding this comment

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

Yeah, you probably want to wait for 0.9.1. The only alternative is disabling formatting for this statement, which seems undesirable. I hope to get a release out later today, depending on if astral-sh/ruff#15378 gets accepted.

Copy link
Member Author

Choose a reason for hiding this comment

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

I mean there is not that big of a rush now, all the other formatting changes are already being handled in separate PRs, so in the end this PR will be small

@@ -815,8 +814,8 @@ def _exception_message(
call_back_name = getattr(msg_callback, "__name__")
return (
f"Exception in {call_back_name} when handling msg on "
f"'{msg.topic}': '{msg.payload}'" # type: ignore[str-bytes-safe]
)
f"'{msg.topic}': '{msg.payload}'"
Copy link
Member Author

Choose a reason for hiding this comment

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

@jbouwh Can you confirm what the desired behaviour is here what mypy is complaining about?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh never mind, ruff moved the type ignore to the next line

@emontnemery
Copy link
Contributor

Please add a link to Ruff's changelog

@joostlek
Copy link
Member Author

I thought you would have enjoyed reading a ton of Rust code :P

Added

@autinerd
Copy link
Contributor

You should also bump the ruff version in pyproject.toml so that the devs see when they didn't update the dependencies.

@joostlek
Copy link
Member Author

I did right?

@autinerd
Copy link
Contributor

Sorry, GitHub web UI is horrible 🙈

pyproject.toml Outdated

Choose a reason for hiding this comment

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

You can now re-enable ISC001. It no longer conflicts with the formatter

"ISC001",

Copy link
Member Author

Choose a reason for hiding this comment

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

In 0.9.0? Or already before that?

Choose a reason for hiding this comment

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

It's no longer conflicting as of Ruff 0.9 (we changed the formatter style to make it compatible)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah check! I will probably do that in a followup then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants