Skip to content

Commit

Permalink
Rename ruff_python_formatter/README.md to CONTRIBUTING.md (#7065)
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Sep 2, 2023
1 parent 45680bb commit 577280c
Showing 1 changed file with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# Rust Python Formatter
# Contributing to the Ruff Formatter

The goal of our formatter is to be compatible with Black except for rare edge cases (mostly
involving comment placement).
involving comment placement). This document outlines the expected development workflow for the
formatter and walks through some of its internals.

You can try an experimental version of the formatter on your project with:
## Testing your changes

```shell
cargo run --bin ruff -- format path/to/your/project
```

Note that currently the only supported option is `line-length` and that both the CLI and the
formatting are a work-in-progress and will change before the stable release.

## Dev tools

**Testing your changes** You can use the `ruff_python_formatter` binary to format individual files
and show debug info. It's fast to compile because it doesn't depend on `ruff`. The easiest way is to
create a `scratch.py` (or `scratch.pyi`) in the project root and run
You can use the `ruff_python_formatter` binary to format individual files and show debug info.
It's fast to compile because it doesn't depend on `ruff`. The easiest way is to create a
`scratch.py` (or `scratch.pyi`) in the project root and run:

```shell
cargo run --bin ruff_python_formatter -- --emit stdout scratch.py
```

which has `--print-ir` and `--print-comments` options. We especially recommend `--print-comments`.
...which supports the `--print-ir` and `--print-comments` flag. (We recommend running with
`--print-comments`.)

<details>
<summary>Usage example</summary>
Expand Down

0 comments on commit 577280c

Please sign in to comment.