Dhruv Manilawala
|
e62e245c61
|
Add support for PEP 701 (#7376)
## Summary
This PR adds support for PEP 701 in Ruff. This is a rollup PR of all the
other individual PRs. The separate PRs were created for logic separation
and code reviews. Refer to each pull request for a detail description on
the change.
Refer to the PR description for the list of pull requests within this PR.
## Test Plan
### Formatter ecosystem checks
Explanation for the change in ecosystem check:
https://github.com/astral-sh/ruff/pull/7597#issue-1908878183
#### `main`
```
| project | similarity index | total files | changed files |
|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76083 | 1789 | 1631 |
| django | 0.99983 | 2760 | 36 |
| transformers | 0.99963 | 2587 | 319 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99983 | 3496 | 18 |
| warehouse | 0.99967 | 648 | 15 |
| zulip | 0.99972 | 1437 | 21 |
```
#### `dhruv/pep-701`
```
| project | similarity index | total files | changed files |
|--------------|------------------:|------------------:|------------------:|
| cpython | 0.76051 | 1789 | 1632 |
| django | 0.99983 | 2760 | 36 |
| transformers | 0.99963 | 2587 | 319 |
| twine | 1.00000 | 33 | 0 |
| typeshed | 0.99983 | 3496 | 18 |
| warehouse | 0.99967 | 648 | 15 |
| zulip | 0.99972 | 1437 | 21 |
```
|
2023-09-29 02:55:39 +00:00 |
|
konsti
|
94b68f201b
|
Fix stylist indentation with a formfeed (#7489)
**Summary** In python, a formfeed is technically undefined behaviour
(https://docs.python.org/3/reference/lexical_analysis.html#indentation):
> A formfeed character may be present at the start of the line; it will
be ignored for
> the indentation calculations above. Formfeed characters occurring
elsewhere in the
> leading whitespace have an undefined effect (for instance, they may
reset the space
> count to zero).
In practice, they just reset the indentation:
df8b3a46a7/Parser/tokenizer.c (L1819-L1821)
a41bb2733f/crates/ruff_python_parser/src/lexer.rs (L664-L667)
The stylist didn't handle formfeeds previously and would produce invalid
indents. The remedy is to cut everything before a form feed.
Checks box for
https://github.com/astral-sh/ruff/issues/7455#issuecomment-1722458825
**Test Plan** Unit test for the stylist and a regression test for the
rule
|
2023-09-19 12:01:16 +02:00 |
|
Micha Reiser
|
40f54375cb
|
Pull in RustPython parser (#6099)
|
2023-07-27 09:29:11 +00:00 |
|
Micha Reiser
|
2cf00fee96
|
Remove parser dependency from ruff-python-ast (#6096)
|
2023-07-26 17:47:22 +02:00 |
|