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 error] PIE804 auto fix does not handle := #11371

Closed
njharman opened this issue May 11, 2024 · 4 comments · Fixed by #11372
Closed

[Fix error] PIE804 auto fix does not handle := #11371

njharman opened this issue May 11, 2024 · 4 comments · Fixed by #11372
Assignees
Labels
bug Something isn't working fixes Related to suggested fixes for violations

Comments

@njharman
Copy link

I believe the issue is ruff 0.4.4 PIE804 auto fix does not handle := with same name as dict key

        func(
              **{
                  "live": False,
                  "url_foo": (url_foo := "http://custom.com"),
                  "url_bar": (url_bar := "http://bespoke.com"),
              },
          )

@zanieb
Copy link
Member

zanieb commented May 11, 2024

What happens? No fix is offered? The fix is incorrect?

@trag1c
Copy link
Contributor

trag1c commented May 11, 2024

Seems like Ruff fixes this as

func(
      live=False,
      url_foo=url_foo := "http://custom.com",
      url_bar=url_bar := "http://bespoke.com",
)

which is a syntax error

@zanieb zanieb added bug Something isn't working fixes Related to suggested fixes for violations labels May 11, 2024
@njharman
Copy link
Author

What happens? No fix is offered? The fix is incorrect?

Ruff fixed, found syntax error then reverted fix (without showing it (or maybe I'm blind?)) and asked me to kindly report it.

@charliermarsh
Copy link
Member

I think they just need to be parenthesized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixes Related to suggested fixes for violations
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants