ruff/crates
Micha Reiser bcf745c5ba
Replace verbatim text with NOT_YET_IMPLEMENTED (#4904)
<!--
Thank you for contributing to Ruff! To help us out with reviewing, please consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->

## Summary

This PR replaces the `verbatim_text` builder with a `not_yet_implemented` builder that emits `NOT_YET_IMPLEMENTED_<NodeKind>` for not yet implemented nodes. 

The motivation for this change is that partially formatting compound statements can result in incorrectly indented code, which is a syntax error:

```python
def func_no_args():
  a; b; c
  if True: raise RuntimeError
  if False: ...
  for i in range(10):
    print(i)
    continue
```

Get's reformatted to

```python
def func_no_args():
    a; b; c
    if True: raise RuntimeError
    if False: ...
    for i in range(10):
    print(i)
    continue
```

because our formatter does not yet support `for` statements and just inserts the text from the source. 

## Downsides

Using an identifier will not work in all situations. For example, an identifier is invalid in an `Arguments ` position. That's why I kept `verbatim_text` around and e.g. use it in the `Arguments` formatting logic where incorrect indentations are impossible (to my knowledge). Meaning, `verbatim_text` we can opt in to `verbatim_text` when we want to iterate quickly on nodes that we don't want to provide a full implementation yet and using an identifier would be invalid. 

## Upsides

Running this on main discovered stability issues with the newline handling that were previously "hidden" because of the verbatim formatting. I guess that's an upside :)

## Test Plan

None?
2023-06-07 14:57:25 +02:00
..
flake8_to_ruff Bump version to 0.0.271 (#4890) 2023-06-06 15:11:48 -04:00
ruff Create fuzzers for testing correctness of parsing, linting and fixing (#4822) 2023-06-07 14:57:07 +02:00
ruff_benchmark Add Formatter benchmark (#4860) 2023-06-05 21:05:42 +02:00
ruff_cache Rename ruff_python_semantic's Context struct to SemanticModel (#4565) 2023-05-22 02:35:03 +00:00
ruff_cli Bump version to 0.0.271 (#4890) 2023-06-06 15:11:48 -04:00
ruff_dev Add a ruff_textwrap crate (#4731) 2023-05-31 16:35:23 +00:00
ruff_diagnostics Use a separate fix-isolation group for every parent node (#4774) 2023-06-02 03:07:55 +00:00
ruff_formatter Rename ruff_formatter::builders::BestFitting to FormatBestFitting (#4841) 2023-06-04 00:13:51 +02:00
ruff_index Introduce ruff_index crate (#4597) 2023-05-23 17:40:35 +02:00
ruff_macros Merge registry into codes (#4651) 2023-06-02 10:33:01 +00:00
ruff_newlines Add a ruff_textwrap crate (#4731) 2023-05-31 16:35:23 +00:00
ruff_python_ast Introduce AnyFunctionDefinition Node (#4898) 2023-06-06 20:37:46 +02:00
ruff_python_formatter Replace verbatim text with NOT_YET_IMPLEMENTED (#4904) 2023-06-07 14:57:25 +02:00
ruff_python_semantic Replace one-off locals property with ScopeFlags (#4912) 2023-06-06 21:22:21 -04:00
ruff_python_stdlib Lint pyproject.toml (#4496) 2023-05-25 12:05:28 +00:00
ruff_rustpython Re-integrate RustPython parser repository (#4359) 2023-05-11 07:47:17 +00:00
ruff_testing_macros testing_macros: Add missing full feature to syn dependency (#4722) 2023-05-30 07:42:06 +00:00
ruff_textwrap Add a ruff_textwrap crate (#4731) 2023-05-31 16:35:23 +00:00
ruff_wasm Add pyflakes.extend-generics setting (#4677) 2023-06-01 22:19:37 +00:00