Skip to content

Add support for ruff #82

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 8 commits into
base: main
Choose a base branch
from

Conversation

felixfontein
Copy link
Collaborator

@felixfontein felixfontein commented May 19, 2025

Fixes #70.

  • Support ruff check
  • Support ruff format
  • Support ruff check --fix

CC @gotmax23

@felixfontein felixfontein marked this pull request as ready for review May 23, 2025 19:51
@felixfontein felixfontein requested a review from gotmax23 May 23, 2025 19:51
@gotmax23
Copy link
Collaborator

I'll take a closer look later, but I think it'd make sense to have just one option to specify the ruff config globally and maybe to remove the somewhat opinionated --select=I default.

@felixfontein
Copy link
Collaborator Author

I'll take a closer look later, but I think it'd make sense to have just one option to specify the ruff config globally

I guess that could be added as an additional feature. Several options (like line length) are global and cannot be configured differently for formatter and linter. That's why I think it's better to be able to configure different config files per situation.

maybe to remove the somewhat opinionated --select=I default.

Without the default, I guess all possible fixes are applied?

Copy link
Contributor

@oraNod oraNod left a comment

Choose a reason for hiding this comment

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

LGTM. Although it looks like there might be some error highlighting in the docs file:

image

I didn't spot what might be causing that though.

@felixfontein
Copy link
Collaborator Author

Hmm, maybe GitHub's syntax highlighter doesn't like indented code blocks / code blocks in lists? 🤷 In any case, my editor doesn't complain, and neither does mkdocs...

felixfontein added a commit to felixfontein/antsibull-nox that referenced this pull request May 29, 2025
@felixfontein
Copy link
Collaborator Author

I'm moving the general docs improvments from this PR to #84 and will rebase once that's merged.

@felixfontein
Copy link
Collaborator Author

@gotmax23 can you please take another look? Thanks.

@@ -78,6 +78,7 @@ class SessionLint(_BaseModel):

default: bool = True
extra_code_files: list[str] = []
ruff_config: t.Optional[p.FilePath] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think a global ruff_package option that behaves that has the same overridable behavior as the global ruff_config also makes sense, but other than that, this looks good to me. Thanks!

Comment on lines +819 to +821
ruff_autofix_select=(
["I"] if ruff_autofix_select is None else ruff_autofix_select
),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
ruff_autofix_select=(
["I"] if ruff_autofix_select is None else ruff_autofix_select
),
ruff_autofix_select=ruff_autofix_select,

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.

Support ruff
3 participants