Skip to content

Commit 0ba5af7

Browse files
committed
Document Python formatting and linting in the rustc-dev-guide
1 parent d9cc4b2 commit 0ba5af7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/doc/rustc-dev-guide/src/conventions.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,26 @@ When modifying that code, use this command to format it:
4040
This uses a pinned version of `clang-format`, to avoid relying on the local
4141
environment.
4242

43+
## Formatting and linting Python code
44+
45+
The rustc repository contains quite a lof of Python code. We try to keep
46+
it both linted and formatted by the [ruff][ruff] tool.
47+
48+
When modifying Python code, use this command to format it:
49+
```sh
50+
./x test tidy --extra-checks=py:fmt --bless
51+
```
52+
53+
and the following command to run lints:
54+
```sh
55+
./x test tidy --extra-checks=py:lint
56+
```
57+
58+
This uses a pinned version of `ruff`, to avoid relying on the local
59+
environment.
60+
61+
[ruff]: https://github.com/astral-sh/ruff
62+
4363
<a id="copyright"></a>
4464

4565
<!-- REUSE-IgnoreStart -->

0 commit comments

Comments
 (0)