ruff/crates
Mike Perlov 646f1942aa
Implement tab autocomplete for ruff config (#15603)
## Summary

Not the most important feature, but hey... was marked as the good first
issue ;-) fixes #4551

Unfortunately, looks like clap only generates proper completions for
zsh, so this would not make any difference for bash/fish.

## Test Plan

- cargo nextest run
- manual test by sourcing completions and then triggering autocomplete:
 
```shell
misha@PandaBook ruff % source <(target/debug/ruff generate-shell-completion zsh)
misha@PandaBook ruff % target/debug/ruff config lin
line-length                                                         -- The line length to use when enforcing long-lines violations
lint                                                                -- Configures how Ruff checks your code.
lint.allowed-confusables                                            -- A list of allowed 'confusable' Unicode characters to ignore
lint.dummy-variable-rgx                                             -- A regular expression used to identify 'dummy' variables, or
lint.exclude                                                        -- A list of file patterns to exclude from linting in addition
lint.explicit-preview-rules                                         -- Whether to require exact codes to select preview rules. Whe
lint.extend-fixable                                                 -- A list of rule codes or prefixes to consider fixable, in ad
lint.extend-ignore                                                  -- A list of rule codes or prefixes to ignore, in addition to
lint.extend-per-file-ignores                                        -- A list of mappings from file pattern to rule codes or prefi
lint.extend-safe-fixes                                              -- A list of rule codes or prefixes for which unsafe fixes sho
lint.extend-select                                                  -- A list of rule codes or prefixes to enable, in addition to
lint.extend-unsafe-fixes                                            -- A list of rule codes or prefixes for which safe fixes shoul
lint.external                                                       -- A list of rule codes or prefixes that are unsupported by Ru
lint.fixable                                                        -- A list of rule codes or prefixes to consider fixable. By de
lint.flake8-annotations                                             -- Print a list of available options
lint.flake8-annotations.allow-star-arg-any                          -- Whether to suppress `ANN401` for dynamically typed `*args`

...
```

- check command help
```shell
❯ target/debug/ruff config -h
List or describe the available configuration options

Usage: ruff config [OPTIONS] [OPTION]

Arguments:
  [OPTION]  Config key to show

Options:
      --output-format <OUTPUT_FORMAT>  Output format [default: text] [possible values: text, json]
  -h, --help                           Print help

Log levels:
  -v, --verbose  Enable verbose logging
  -q, --quiet    Print diagnostics, but nothing else
  -s, --silent   Disable all logging (but still exit with status code "1" upon detecting diagnostics)

Global options:
      --config <CONFIG_OPTION>  Either a path to a TOML configuration file (`pyproject.toml` or `ruff.toml`), or a TOML `<KEY> =
                                <VALUE>` pair (such as you might find in a `ruff.toml` configuration file) overriding a specific
                                configuration option. Overrides of individual settings using this option always take precedence over
                                all configuration files, including configuration files that were also specified using `--config`
      --isolated                Ignore all configuration files
```

- running original command
```shell
❯ target/debug/ruff config
cache-dir
extend
output-format
fix
unsafe-fixes
fix-only
show-fixes
required-version
preview
exclude
extend-exclude
extend-include
force-exclude
include
respect-gitignore
builtins
namespace-packages
target-version
src
line-length
indent-width
lint
format
analyze
```
2025-01-27 20:39:04 +05:30
..
red_knot Improve the file watching failure error message (#15728) 2025-01-24 15:28:30 -06:00
red_knot_project [red-knot] Add --ignore, --warn, and --error CLI arguments (#15689) 2025-01-24 16:20:15 +01:00
red_knot_python_semantic [red-knot] Document public symbol type inferece (#15766) 2025-01-27 10:52:13 +01:00
red_knot_server [red-knot] Make Diagnostic::file optional (#15640) 2025-01-23 10:43:14 +01:00
red_knot_test [red-knot] Support custom typeshed Markdown tests (#15683) 2025-01-23 12:36:38 +01:00
red_knot_vendored [red-knot] Migrate is_gradual_equivalent_to unit tests to Markdown tests (#15563) 2025-01-17 16:48:01 -08:00
red_knot_wasm Create Unknown rule diagnostics with a source range (#15648) 2025-01-23 12:50:43 +01:00
ruff Implement tab autocomplete for ruff config (#15603) 2025-01-27 20:39:04 +05:30
ruff_annotate_snippets Fix docstring in ruff_annotate_snippets (#15748) 2025-01-26 22:25:29 -05:00
ruff_benchmark [red-knot] Use Unknown | T_inferred for undeclared public symbols (#15674) 2025-01-24 12:47:48 +01:00
ruff_cache Fix cache key collisions for paths with separators (#12159) 2024-07-03 07:36:46 -05:00
ruff_db [red-knot] Add --ignore, --warn, and --error CLI arguments (#15689) 2025-01-24 16:20:15 +01:00
ruff_dev Alternate quotes for strings inside f-strings in preview (#13860) 2024-10-23 07:57:53 +02:00
ruff_diagnostics Show errors for attempted fixes only when passed --verbose (#15237) 2025-01-03 08:50:13 -06:00
ruff_formatter Upgrade Rust toolchain to 1.84.0 (#15408) 2025-01-11 09:51:58 +01:00
ruff_graph Add support for configuring knot in pyproject.toml files (#15493) 2025-01-17 09:41:06 +01:00
ruff_index [red-knot] small efficiency improvements and bugfixes to use-def map building (#12373) 2024-07-18 09:24:58 -07:00
ruff_linter Add references to trio.run_process and anyio.run_process (#15761) 2025-01-27 01:52:03 +00:00
ruff_macros Flatten red_knot_project import paths (#15616) 2025-01-20 14:57:57 +01:00
ruff_notebook Bump MSRV to Rust 1.80 (#13826) 2024-10-20 10:55:36 +02:00
ruff_python_ast Preserve raw string prefix and escapes (#15694) 2025-01-23 12:12:10 -05:00
ruff_python_ast_integration_tests Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_python_codegen Preserve raw string prefix and escapes (#15694) 2025-01-23 12:12:10 -05:00
ruff_python_formatter Remove customizable reference enum names (#15647) 2025-01-21 13:46:31 -05:00
ruff_python_index Extract LineIndex independent methods from Locator (#13938) 2024-10-28 07:53:41 +00:00
ruff_python_literal Upgrade Rust toolchain to 1.83 (#14677) 2024-11-29 12:05:05 +00:00
ruff_python_parser Parse triple quoted string annotations as if parenthesized (#15387) 2025-01-16 11:38:15 +05:30
ruff_python_resolver Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_python_semantic Remove customizable reference enum names (#15647) 2025-01-21 13:46:31 -05:00
ruff_python_stdlib Revert "Add all PEP-585 names to UP006 rule" (#15250) 2025-01-04 12:23:53 +01:00
ruff_python_trivia type: ignore[codes] and knot: ignore (#15078) 2024-12-23 10:52:43 +01:00
ruff_python_trivia_integration_tests Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
ruff_server Consider unsafe-fixes settings for code actions (#15666) 2025-01-22 13:44:13 +05:30
ruff_source_file [pyupgrade] Do not report when a UTF-8 comment is followed by a non-UTF-8 one (UP009) (#14728) 2024-12-11 10:30:41 +00:00
ruff_text_size [ruff] itertools.starmap(..., zip(...)) (RUF058) (#15483) 2025-01-16 15:18:12 +01:00
ruff_wasm Bump version to 0.9.3 (#15698) 2025-01-23 12:43:56 -06:00
ruff_workspace [pydoclint] Allow ignoring one line docstrings for DOC rules (#13302) 2025-01-16 16:05:10 -06:00