ruff/crates/ruff_cli/src
Jane Lewis 7504bf347b
`--show-settings` displays active settings in a far more readable format (#9464)
<!--
Thank you for contributing to Ruff! To help us out with reviewing,
please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

Fixes #8334.

`Display` has been implemented for `ruff_workspace::Settings`, which
gives a much nicer and more readable output to `--show-settings`.

Internally, a `display_settings` utility macro has been implemented to
reduce the boilerplate of the display code.

### Work to be done

- [x] A lot of formatting for `Vec<_>` and `HashSet<_>` types have been
stubbed out, using `Debug` as a fallback. There should be a way to add
generic formatting support for these types as a modifier in
`display_settings`.
- [x] Several complex types were also stubbed out and need proper
`Display` implementations rather than falling back on `Debug`.
- [x] An open question needs to be answered: how important is it that
the output be valid TOML? Some types in settings, such as a hash-map
from a glob pattern to a multi-variant enum, will be hard to rework into
valid _and_ readable TOML.
- [x] Tests need to be implemented.

## Test Plan

Tests consist of a snapshot test for the default `--show-settings`
output and a doctest for `display_settings!`.
2024-01-12 14:30:29 -05:00
..
bin Replace `.map_or(false, $closure)` with `.is_some_and(closure)` (#6244) 2023-08-01 19:29:42 +02:00
commands `--show-settings` displays active settings in a far more readable format (#9464) 2024-01-12 14:30:29 -05:00
snapshots Add `ruff version` with long version display (#8034) 2023-10-20 14:07:41 -05:00
args.rs Add `--extension` support to the formatter (#9483) 2024-01-12 18:53:25 +00:00
cache.rs Move `pyproject_config` into `Resolver` (#9453) 2024-01-10 17:58:53 -05:00
diagnostics.rs Add `--extension` support to the formatter (#9483) 2024-01-12 18:53:25 +00:00
lib.rs Update `ruff check` and `ruff format` to default to the current directory (#8791) 2023-11-21 11:34:21 -06:00
panic.rs Disallow `unreachable_pub` (#4314) 2023-05-11 18:00:00 -04:00
printer.rs Feature: Add SARIF output support (#9078) 2023-12-13 00:33:19 -05:00
resolve.rs Improve debug printing for resolving origin of config settings (#8729) 2023-11-17 01:10:36 +00:00
stdin.rs Write unchanged, excluded files to stdout when read via stdin (#8596) 2023-11-09 23:15:01 -05:00
version.rs Add `ruff version` with long version display (#8034) 2023-10-20 14:07:41 -05:00