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

Replace --show-source and --no-show-source with --output_format=<full|concise> #9687

Merged
merged 10 commits into from
Jan 30, 2024

Conversation

snowsignal
Copy link
Contributor

@snowsignal snowsignal commented Jan 29, 2024

Fixes #7350

Summary

  • --show-source and --no-show-source are now deprecated.
  • output-format supports two new variants, full and concise. text is now a deprecated variant, and any use of it is treated as the default serialization format.
  • --output-format now default to concise
  • In preview mode, --output-format defaults to full
  • --show-source will still set --output-format to full if the output format is not otherwise specified.
  • likewise, --no-show-source can override an output format that was set in a file-based configuration, though it will also be overridden by --output-format

Test Plan

A lot of tests were updated to use --output-format=full. Additional tests were added to ensure the correct deprecation warnings appeared, and that deprecated options behaved as intended.

@snowsignal snowsignal added the cli Related to the command-line interface label Jan 29, 2024
@snowsignal snowsignal changed the title Replace --show-source and --no-show-source with output_format=<full|concise> Replace --show-source and --no-show-source with --output_format=<full|concise> Jan 29, 2024
@zanieb
Copy link
Member

zanieb commented Jan 29, 2024

Woo! Maybe we should merge this into release/0.2.0 instead?

crates/ruff/src/printer.rs Outdated Show resolved Hide resolved
crates/ruff/src/args.rs Outdated Show resolved Hide resolved
docs/configuration.md Outdated Show resolved Hide resolved
@snowsignal snowsignal changed the base branch from main to release/0.2.0 January 29, 2024 19:39
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

This is great work -- really thorough and well-done. My only concern is: should we merge with concise as the default for now, so that it's not a change in behavior and just a deprecation?

crates/ruff/src/args.rs Outdated Show resolved Hide resolved
crates/ruff/src/args.rs Show resolved Hide resolved
crates/ruff/src/printer.rs Outdated Show resolved Hide resolved
docs/configuration.md Outdated Show resolved Hide resolved
@snowsignal
Copy link
Contributor Author

My only concern is: should we merge with concise as the default for now, so that it's not a change in behavior and just a deprecation?

That's a good question! I thought it would be useful to solve two issues at once, but if it's too big of a change I'd be OK with splitting the changes into a separate PR. I'm curious to know your thoughts on this @zanieb.

@zanieb
Copy link
Member

zanieb commented Jan 29, 2024

So I feel like the concern is that someone doesn't like the new output then is upset that the flag to toggle it back is deprecated? Perhaps it's just that there are too many changes in a single release?

My suggestion would be to gate the default with preview if feasible e.g. if --preview is passed then use --output-format=full and if not then use --output-format=concise. This would allow us to roll out the change in default separately in 0.3.0 instead.

Curious for @charliermarsh's thoughts though before we go changing things.

@snowsignal
Copy link
Contributor Author

I added a new bundle of tests that ensure the deprecated options behave as expected.

So I feel like the concern is that someone doesn't like the new output then is upset that the flag to toggle it back is deprecated? Perhaps it's just that there are too many changes in a single release?

I understand that concern, but doesn't --output-format=concise solve that for them? Anyone using the deprecated flags will ideally get pointed in the right direction with the warning messages.

That being said, I'm not against gating this behind preview (though it would mean more work to split up these changes)

@snowsignal snowsignal force-pushed the jane/cli/replace-show-sources-with-format branch 2 times, most recently from 49df927 to 9ba18cb Compare January 29, 2024 22:12
@snowsignal snowsignal force-pushed the jane/cli/replace-show-sources-with-format branch from 9ba18cb to 71e7408 Compare January 29, 2024 22:13
@charliermarsh
Copy link
Member

Hmm yeah, introspecting a bit, I think my concern is that I wanted more user feedback before deciding that the full output format should be the default (which is a change from main, though was intended to be a settled decision per the relevant issue). So I was hoping to ship it to preview first to give us a chance to react to user feedback on the change. But I'm willing to give up on that, perhaps I'm being too cautious?

@zanieb
Copy link
Member

zanieb commented Jan 29, 2024

I think we're pretty settled on wanting to move that direction as our default output because we can build a lot on top of it.

@snowsignal snowsignal force-pushed the jane/cli/replace-show-sources-with-format branch from 1a6e0fe to 8ebc7c7 Compare January 29, 2024 23:23
@snowsignal
Copy link
Contributor Author

I've reverted us back to using concise as a default value. I'm fine with gating this behind preview until 0.3.0.

Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

Excellent! I'm still open to changing the default in v0.2.0, but we don't have to decide that to merge this PR.

@snowsignal snowsignal force-pushed the jane/cli/replace-show-sources-with-format branch from bd27bb5 to e06a385 Compare January 30, 2024 00:45
@snowsignal snowsignal merged commit b244178 into release/0.2.0 Jan 30, 2024
16 of 17 checks passed
@snowsignal snowsignal deleted the jane/cli/replace-show-sources-with-format branch January 30, 2024 00:57
@zanieb zanieb added the preview Related to preview mode features label Jan 30, 2024
zanieb added a commit that referenced this pull request Jan 30, 2024
Fixes a regression in the ecosystem checks from
#9687 which was causing them to
run for multiple hours due to the size of the output.

We need the concise format for comparisons.

We should probably update the ecosystem checks to actually diff the full
output in the future because that'd be nice.
zanieb pushed a commit that referenced this pull request Jan 30, 2024
…<full|concise>` (#9687)

Fixes #7350

## Summary

* `--show-source` and `--no-show-source` are now deprecated.
* `output-format` supports two new variants, `full` and `concise`.
`text` is now a deprecated variant, and any use of it is treated as the
default serialization format.
* `--output-format` now default to `concise`
* In preview mode, `--output-format` defaults to `full`
* `--show-source` will still set `--output-format` to `full` if the
output format is not otherwise specified.
* likewise, `--no-show-source` can override an output format that was
set in a file-based configuration, though it will also be overridden by
`--output-format`

## Test Plan

A lot of tests were updated to use `--output-format=full`. Additional
tests were added to ensure the correct deprecation warnings appeared,
and that deprecated options behaved as intended.
zanieb added a commit that referenced this pull request Jan 30, 2024
Fixes a regression in the ecosystem checks from
#9687 which was causing them to
run for multiple hours due to the size of the output.

We need the concise format for comparisons.

We should probably update the ecosystem checks to actually diff the full
output in the future because that'd be nice.
zanieb added a commit that referenced this pull request Feb 1, 2024
…<full|concise>` (#9687)

Fixes #7350

## Summary

* `--show-source` and `--no-show-source` are now deprecated.
* `output-format` supports two new variants, `full` and `concise`.
`text` is now a deprecated variant, and any use of it is treated as the
default serialization format.
* `--output-format` now default to `concise`
* In preview mode, `--output-format` defaults to `full`
* `--show-source` will still set `--output-format` to `full` if the
output format is not otherwise specified.
* likewise, `--no-show-source` can override an output format that was
set in a file-based configuration, though it will also be overridden by
`--output-format`

## Test Plan

A lot of tests were updated to use `--output-format=full`. Additional
tests were added to ensure the correct deprecation warnings appeared,
and that deprecated options behaved as intended.
# Conflicts:
#	crates/ruff/tests/integration_test.rs
zanieb added a commit that referenced this pull request Feb 1, 2024
Fixes a regression in the ecosystem checks from
#9687 which was causing them to
run for multiple hours due to the size of the output.

We need the concise format for comparisons.

We should probably update the ecosystem checks to actually diff the full
output in the future because that'd be nice.
# Conflicts:
#	python/ruff-ecosystem/ruff_ecosystem/projects.py
zanieb added a commit that referenced this pull request Feb 1, 2024
…<full|concise>` (#9687)

Fixes #7350

## Summary

* `--show-source` and `--no-show-source` are now deprecated.
* `output-format` supports two new variants, `full` and `concise`.
`text` is now a deprecated variant, and any use of it is treated as the
default serialization format.
* `--output-format` now default to `concise`
* In preview mode, `--output-format` defaults to `full`
* `--show-source` will still set `--output-format` to `full` if the
output format is not otherwise specified.
* likewise, `--no-show-source` can override an output format that was
set in a file-based configuration, though it will also be overridden by
`--output-format`

## Test Plan

A lot of tests were updated to use `--output-format=full`. Additional
tests were added to ensure the correct deprecation warnings appeared,
and that deprecated options behaved as intended.
# Conflicts:
#	crates/ruff/tests/integration_test.rs
zanieb added a commit that referenced this pull request Feb 1, 2024
Fixes a regression in the ecosystem checks from
#9687 which was causing them to
run for multiple hours due to the size of the output.

We need the concise format for comparisons.

We should probably update the ecosystem checks to actually diff the full
output in the future because that'd be nice.
# Conflicts:
#	python/ruff-ecosystem/ruff_ecosystem/projects.py
@@ -325,9 +321,14 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result<ExitStatus> {
printer_flags,
);

let preview = overrides.preview.unwrap_or_default().is_enabled();
Copy link
Member

Choose a reason for hiding this comment

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

Does this respect preview = true in configuration files? I think this might only respect --preview when it's set on the command line -- is that deliberate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No that was not deliberate, good catch.

Copy link
Member

Choose a reason for hiding this comment

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

No worries! Was trying to pin down the build failures on #9599 after merging in main, and spotted this :)

hartwork added a commit to kevin1024/vcrpy that referenced this pull request Jun 30, 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 preview Related to preview mode features
Projects
None yet
4 participants