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

Add lint.preview #8002

Merged
merged 1 commit into from
Oct 18, 2023
Merged

Add lint.preview #8002

merged 1 commit into from
Oct 18, 2023

Conversation

MichaReiser
Copy link
Member

Summary

This PR adds a new lint.preview option similar to format.preview that controls whether preview mode is enabled for the linter.

Closes #7649

Test Plan

I wrapped the into_settings of the formatter and linter in dbg expressions and verified that:

  • lint.preview = true -> Preview mode is enabled for the linter only
  • format.preview = true -> Preview mode is enabled for the formatter only
  • preview = true -> Preview mode is enabled for both the linter and the formatter.
  • --preview overrides the preview, lint.preview, and format.preview option
  • preview = true and lint.preview = false enables preview for the formatter only (same test for the linter)

@MichaReiser MichaReiser added configuration Related to settings and configuration cli Related to the command-line interface labels Oct 17, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 17, 2023

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

@konstin
Copy link
Member

konstin commented Oct 17, 2023

Is it intentional that we have tool.ruff.format.preview but no ruff format --preview? Otherwise i would implement the latter because i need it for the ecosystem check with preview style.

@MichaReiser
Copy link
Member Author

Is it intentional that we have tool.ruff.format.preview but no ruff format --preview? Otherwise i would implement the latter because i need it for the ecosystem check with preview style.

No. I can add it as part of this or another PR or you can add it. Let me know what you prefer

@MichaReiser MichaReiser changed the title Add lint.preview option Add lint.preview and format --preview options Oct 17, 2023
@MichaReiser MichaReiser changed the title Add lint.preview and format --preview options Add lint.preview Oct 17, 2023
@MichaReiser
Copy link
Member Author

Is it intentional that we have tool.ruff.format.preview but no ruff format --preview? Otherwise i would implement the latter because i need it for the ecosystem check with preview style.

No. I can add it as part of this or another PR or you can add it. Let me know what you prefer

Actually, the CLI options are already supported. It's just that they were hidden until now (because we didn't support any preview styles)

@konstin
Copy link
Member

konstin commented Oct 17, 2023

Actually, the CLI options are already supported. It's just that they were hidden until now (because we didn't support any preview styles)

🤦 should have checked, thanks

@zanieb
Copy link
Member

zanieb commented Oct 17, 2023

Can you update the docs in preview.md or would you prefer that I did?

crates/ruff_cli/src/args.rs Show resolved Hide resolved
crates/ruff_cli/src/args.rs Show resolved Hide resolved
Base automatically changed from format-lint-exclude-option to main October 18, 2023 01:15
Add a new `lint.preview` option that configures the preview mode for the linter only.
@MichaReiser
Copy link
Member Author

MichaReiser commented Oct 18, 2023

Can you update the docs in preview.md or would you prefer that I did?

I created #8032 for updating the documentation to unblock the code changes and get review feedback on the documentation.

@MichaReiser MichaReiser merged commit 94b4bb0 into main Oct 18, 2023
15 checks passed
@MichaReiser MichaReiser deleted the lint-preview-option branch October 18, 2023 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command-line interface configuration Related to settings and configuration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatter: Add preview option
4 participants