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

Make --config and --isolated global flags #10150

Merged
merged 19 commits into from Mar 4, 2024

Conversation

AlexWaygood
Copy link
Member

Summary

Fixes #9892.

This PR makes --config and --isolated global flags that are accepted by all ruff subcommands: ruff will no longer error out if a redundant --config argument is passed to a command such as ruff version or ruff rule. The flag has no effect for subcommands that do not need it (but it is still validated).

Test Plan

There were no tests for ruff version, so I added them as part of this PR, and used the new tests to assert that the --config flag is now accepted by ruff version. I also manually tested to check things were working as expected.

crates/ruff/src/lib.rs Outdated Show resolved Hide resolved
crates/ruff/src/version.rs Outdated Show resolved Hide resolved
crates/ruff/src/args.rs Show resolved Hide resolved
crates/ruff/src/args.rs Outdated Show resolved Hide resolved
docs/configuration.md Outdated Show resolved Hide resolved
Copy link
Contributor

github-actions bot commented Feb 28, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser added the cli Related to the command-line interface label Feb 28, 2024
docs/configuration.md Outdated Show resolved Hide resolved
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Improvements that we could make that are unrelated to your change but could improve readability (as separate PRs):

  • Rename HelpFormat to OutputFormat.
  • Move ConfigArguments next to FormatArguments and CheckArguments.

crates/ruff/src/args.rs Outdated Show resolved Hide resolved
@AlexWaygood
Copy link
Member Author

Alright, ready for another look, I think 😅 the implementation now uses clap(flatten), as you suggested!

crates/ruff/src/args.rs Outdated Show resolved Hide resolved
@AlexWaygood AlexWaygood enabled auto-merge (squash) March 4, 2024 11:14
@AlexWaygood AlexWaygood merged commit 8b749e1 into astral-sh:main Mar 4, 2024
17 checks passed
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--config as a global flag/env var
3 participants