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

test: follow RUF051 recommendations #21518

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

jelly
Copy link
Member

@jelly jelly commented Jan 14, 2025

Ruff 0.8.3 enables a new preview rule RUF051 if-key-in-dict-del, preferring .pop() over a conditional check plus a separate del statement.

Ruff 0.8.3 enables a new preview rule RUF051 `if-key-in-dict-del`,
preferring `.pop()` over a conditional check plus a separate del
statement.
@jelly jelly force-pushed the new-year-new-ruff branch from 78d29dc to c013109 Compare January 14, 2025 13:16
Copy link
Member

@allisonkarlitskaya allisonkarlitskaya 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, thanks!

del options['dhcp']
options.pop('address', None)
options.pop('dns', None)
options.pop('dhcp', None)
if 'restrict' not in options:
options['restrict'] = restrict
Copy link
Member

Choose a reason for hiding this comment

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

These two adjacent lines look a bit like we might get a future complaint about using .setdefault(), no?

@martinpitt martinpitt merged commit 7925b7c into cockpit-project:main Jan 15, 2025
84 of 85 checks passed
@jelly jelly deleted the new-year-new-ruff branch January 15, 2025 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants