ruff/crates
konstin 0f2979ed66 Formatter: Show preceding, following and enclosing of comments
**Summary** I used to always add `dbg!` for preceding, following and enclosing. With this change `--print-comments` can do this instead.
```python
import re  # import

def to_camel_case(node: str) -> str:
    """Converts PascalCase to camel_case"""
    return re.sub("([A-Z])", r"_\1", node).lower().lstrip("_")

# a
if True:
    pass  # b
else:
    print()
```
Debug output:
```
11..19 Some((StmtImport, 0..9)) Some((StmtFunctionDef, 22..165)) (ModModule, 0..213) "# import"
168..171 Some((StmtFunctionDef, 22..165)) Some((StmtIf, 172..212)) (ModModule, 0..213) "# a"
191..194 Some((StmtPass, 185..189)) Some((ElifElseClause, 195..212)) (StmtIf, 172..212) "# b"
```

**Test Plan** n/a
2023-08-23 12:55:24 +02:00
..
flake8_to_ruff Bump version to 0.0.282 (#6241) 2023-08-01 13:21:33 +00:00
ruff Match left-hand side `types()` call in `types-comparison` (#6326) 2023-08-03 23:01:23 -04:00
ruff_benchmark Remove `Parse` trait (#6235) 2023-08-01 18:35:03 +02:00
ruff_cache Only use a single cache file per Python package (#5117) 2023-06-19 17:46:13 +02:00
ruff_cli Replace `.map_or(false, $closure)` with `.is_some_and(closure)` (#6244) 2023-08-01 19:29:42 +02:00
ruff_dev Make formatter ecosystem check failure output better understandable (#6300) 2023-08-03 20:23:25 +02:00
ruff_diagnostics Skip partial duplicates when applying multi-edit fixes (#6144) 2023-07-29 12:11:57 +00:00
ruff_formatter Generalize comment-after-bracket handling to lists, sets, etc. (#6320) 2023-08-04 01:28:05 +00:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_macros Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
ruff_python_ast Return a slice in `StmtClassDef#bases` (#6311) 2023-08-03 16:21:55 +00:00
ruff_python_codegen Use `range: _` in lieu of `range: _range` (#6296) 2023-08-02 22:11:13 -04:00
ruff_python_formatter Formatter: Show preceding, following and enclosing of comments 2023-08-23 12:55:24 +02:00
ruff_python_index Avoid detecting continuations at non-start-of-line (#6219) 2023-08-01 00:20:29 -04:00
ruff_python_literal [`pylint`] Implement Pylint `bad-format-character` (`E1300`) (#6171) 2023-08-02 21:32:43 +00:00
ruff_python_parser Box type params and arguments fields on the class definition node (#6275) 2023-08-02 16:47:06 +00:00
ruff_python_resolver Replace `.map_or(false, $closure)` with `.is_some_and(closure)` (#6244) 2023-08-01 19:29:42 +02:00
ruff_python_semantic Make the `Nodes` vector generic on node type (#6328) 2023-08-04 03:57:15 +00:00
ruff_python_stdlib Replace `.map_or(false, $closure)` with `.is_some_and(closure)` (#6244) 2023-08-01 19:29:42 +02:00
ruff_python_trivia Remove `Parse` trait (#6235) 2023-08-01 18:35:03 +02:00
ruff_shrinking Use tracing for format_dev (#6177) 2023-07-31 19:14:01 +00:00
ruff_source_file Skip BOM when determining Locator's line starts (#6159) 2023-07-29 11:47:13 +00:00
ruff_text_size Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
ruff_wasm Skip partial duplicates when applying multi-edit fixes (#6144) 2023-07-29 12:11:57 +00:00