Skip to content

Commit c91cc29

Browse files
Update the formatter README (#8166)
We can decide whether we want to keep this at all, but for now, just making it consistent with the release.
1 parent 8b665f4 commit c91cc29

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

crates/ruff_python_formatter/README.md

+25-26
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
# Ruff Formatter
22

33
The Ruff formatter is an extremely fast Python code formatter that ships as part of the `ruff`
4-
CLI (as of Ruff v0.0.289).
5-
6-
The formatter is currently in an **Alpha** state. The Alpha is primarily intended for
7-
experimentation: our focus is on collecting feedback that we can address prior to a production-ready
8-
Beta release later this year. (While we're using the formatter in production on our own projects,
9-
the CLI, configuration options, and code style may change arbitrarily between the Alpha and Beta.)
10-
11-
[_We'd love to hear your feedback._](https://github.com/astral-sh/ruff/discussions/7310)
4+
CLI.
125

136
## Goals
147

@@ -30,7 +23,7 @@ For details, see [Black compatibility](#black-compatibility).
3023

3124
## Getting started
3225

33-
The Ruff formatter shipped in an Alpha state as part of Ruff v0.0.289.
26+
The Ruff formatter is available in Beta as of Ruff v0.1.2.
3427

3528
### CLI
3629

@@ -46,41 +39,48 @@ Arguments:
4639
[FILES]... List of files or directories to format
4740

4841
Options:
49-
--check Avoid writing any formatted files back; instead, exit with a non-zero status code if any files would have been modified, and zero otherwise
50-
--config <CONFIG> Path to the `pyproject.toml` or `ruff.toml` file to use for configuration
51-
-h, --help Print help
52-
53-
File selection:
54-
--respect-gitignore Respect file exclusions via `.gitignore` and other standard ignore files
55-
--force-exclude Enforce exclusions, even for paths passed to Ruff directly on the command-line
42+
--check
43+
Avoid writing any formatted files back; instead, exit with a non-zero status code if any files would have been modified, and zero otherwise
44+
--diff
45+
Avoid writing any formatted files back; instead, exit with a non-zero status code and the difference between the current file and how the formatted file would look like
46+
--config <CONFIG>
47+
Path to the `pyproject.toml` or `ruff.toml` file to use for configuration
48+
--target-version <TARGET_VERSION>
49+
The minimum Python version that should be supported [possible values: py37, py38, py39, py310, py311, py312]
50+
--preview
51+
Enable preview mode; enables unstable formatting. Use `--no-preview` to disable
52+
-h, --help
53+
Print help
5654

5755
Miscellaneous:
56+
-n, --no-cache Disable cache reads
57+
--cache-dir <CACHE_DIR> Path to the cache directory [env: RUFF_CACHE_DIR=]
5858
--isolated Ignore all configuration files
5959
--stdin-filename <STDIN_FILENAME> The name of the file when passing it through stdin
6060

61+
File selection:
62+
--respect-gitignore Respect file exclusions via `.gitignore` and other standard ignore files. Use `--no-respect-gitignore` to disable
63+
--exclude <FILE_PATTERN> List of paths, used to omit files and/or directories from analysis
64+
--force-exclude Enforce exclusions, even for paths passed to Ruff directly on the command-line. Use `--no-force-exclude` to disable
65+
6166
Log levels:
6267
-v, --verbose Enable verbose logging
6368
-q, --quiet Print diagnostics, but nothing else
6469
-s, --silent Disable all logging (but still exit with status code "1" upon detecting diagnostics)
6570
```
6671

67-
Note: `ruff format` is currently hidden by default and will not be visible when running
68-
`ruff --help`.
69-
7072
Similar to Black, running `ruff format /path/to/file.py` will format the given file or directory
7173
in-place, while `ruff format --check /path/to/file.py` will avoid writing any formatted files back,
7274
instead exiting with a non-zero status code if any files are not already formatted.
7375

7476
### VS Code
7577

76-
As of `v2023.36.0`, the [Ruff VS Code extension](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)
77-
ships with support for the Ruff formatter. To enable formatting capabilities, set the
78-
`ruff.enableExperimentalFormatter` setting to `true` in your `settings.json`, and mark the Ruff
78+
As of `v2023.44.0`, the [Ruff VS Code extension](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)
79+
ships with full support for the Ruff formatter. To enable formatting capabilities, mark the Ruff
7980
extension as your default Python formatter:
8081

8182
```json
8283
{
83-
"ruff.enableExperimentalFormatter": true,
8484
"[python]": {
8585
"editor.defaultFormatter": "charliermarsh.ruff"
8686
}
@@ -92,7 +92,6 @@ on-save by adding `"editor.formatOnSave": true` to your `settings.json`:
9292

9393
```json
9494
{
95-
"ruff.enableExperimentalFormatter": true,
9695
"[python]": {
9796
"editor.defaultFormatter": "charliermarsh.ruff",
9897
"editor.formatOnSave": true
@@ -110,10 +109,10 @@ as in:
110109

111110
```toml
112111
[tool.ruff.format]
113-
# Use tabs instead of 4 space indentation
112+
# Use tabs instead of 4 space indentation.
114113
indent-style = "tab"
115114

116-
# Prefer single quotes over double quotes
115+
# Prefer single quotes over double quotes.
117116
quote-style = "single"
118117
```
119118

0 commit comments

Comments
 (0)