Skip to content

chore: add ruff format --check #5774

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rexledesma
Copy link
Contributor

@rexledesma rexledesma commented May 8, 2025

Depends on #5773.

Summary

Add a ruff format step for the Python files generated by contributors.

Main file to look at here is 4f14a31#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd.

Test Plan

RustPython on  rl/add-ruff-format via 🐍 v3.13.2 via 🦀 v1.86.0 
❯ uvx --from "ruff==0.11.8" ruff format --check
217 files already formatted

@rexledesma rexledesma force-pushed the rl/add-ruff-format branch from 4f14a31 to 6f0b586 Compare May 8, 2025 12:24
@@ -41,13 +41,15 @@
assert c == 2
assert d == 3

a, = [1]
(a,) = [1]
Copy link
Member

Choose a reason for hiding this comment

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

Files with syntax_ prefix is intentionally testing these kind of syntax. Please review those files not to lose this intentions

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't ruff be configured to ignore those lints? That would be preferable in my opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two options here to make immediate progress:

  1. We can ignore syntax_*.py in ruff.toml entirely
  2. We can add ruff directives to each of these syntax_*.py files to ignore formatting for the entire file. + add a TODO to refine the directive to the specific line if someone edits the file in the future.

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