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
Dhruv Manilawala
c2bd8af59a
Remove triple-quoted string ranges computation ( #7476 )
...
## Summary
This is a follow-up PR for #7435 to remove the now unused triple-quoted
string ranges from the indexer.
2023-09-18 20:57:49 +05:30
konsti
2cbe1733c8
Use CommentRanges in backwards lexing ( #7360 )
...
## Summary
The tokenizer was split into a forward and a backwards tokenizer. The
backwards tokenizer uses the same names as the forwards ones (e.g.
`next_token`). The backwards tokenizer gets the comment ranges that we
already built to skip comments.
---------
Co-authored-by: Micha Reiser <micha@reiser.io>
2023-09-16 03:21:45 +00:00
Charlie Marsh
fc89976c24
Move Ranged
into ruff_text_size
( #6919 )
...
## Summary
The motivation here is that this enables us to implement `Ranged` in
crates that don't depend on `ruff_python_ast`.
Largely a mechanical refactor with a lot of regex, Clippy help, and
manual fixups.
## Test Plan
`cargo test`
2023-08-27 14:12:51 -04:00
Charlie Marsh
847432cacf
Avoid attempting to fix PT018 in multi-statement lines ( #6829 )
...
## Summary
These fixes will _always_ fail, so we should avoid trying to construct
them in the first place.
Closes https://github.com/astral-sh/ruff/issues/6812 .
2023-08-23 19:09:34 -04:00
Charlie Marsh
42ff833d00
Remove comment lexing from isort ( #6794 )
...
## Summary
No need to lex to find comments -- we already know their locations via
`Indexer`.
2023-08-22 21:26:38 +00:00
Charlie Marsh
88b984e885
Avoid detecting continuations at non-start-of-line ( #6219 )
...
## Summary
Previously, given:
```python
a = \
5;
```
When detecting continuations starting at the offset of the `;`, we'd
flag the previous line as a continuation. We should only flag a
continuation if there isn't leading content prior to the offset.
Closes https://github.com/astral-sh/ruff/issues/6214
2023-08-01 00:20:29 -04: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