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

Allow additional arguments for sum and max comprehensions #12364

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

charliermarsh
Copy link
Member

Summary

These can have other arguments, so it seems wrong to gate on single argument here.

Closes #12358.

call.args[0].comma = Some(Comma {
whitespace_after: ParenthesizableWhitespace::default(),
..comma.clone()
});
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this, we were (1) dropping commas in some tests (see fixture changes), and (2) adding an extra space after the comma when fixing sum([x.val for x in bar], 0) (not sure why?).

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I don't remember why this was None but this seems correct to me. It might've been some weird comment placement, not sure though.

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+6 -0 violations, +0 -0 fixes in 2 projects; 52 projects unchanged)

bokeh/bokeh (+1 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview --select ALL

+ examples/models/calendars.py:47:31: C419 Unnecessary list comprehension

mlflow/mlflow (+5 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ tests/store/tracking/__init__.py:62:27: C419 Unnecessary list comprehension
+ tests/store/tracking/test_file_store.py:372:23: C419 Unnecessary list comprehension
+ tests/store/tracking/test_sqlalchemy_store.py:2548:28: C419 Unnecessary list comprehension
+ tests/store/tracking/test_sqlalchemy_store.py:2562:28: C419 Unnecessary list comprehension
+ tests/store/tracking/test_sqlalchemy_store.py:282:23: C419 Unnecessary list comprehension

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
C419 6 6 0 0 0

@charliermarsh charliermarsh added the bug Something isn't working label Jul 17, 2024
Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

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

Good find!

@charliermarsh charliermarsh merged commit 9b9d701 into main Jul 18, 2024
20 checks passed
@charliermarsh charliermarsh deleted the charlie/C419 branch July 18, 2024 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C419 in --preview does not warn if a second parameter is passed to sum()
3 participants