ruff/crates
Andrew Gallant d9845a2628
format doctests in docstrings (#8811)
## Summary

This PR adds opt-in support for formatting doctests in docstrings. This
reflects initial support and it is intended to add support for Markdown
and reStructuredText Python code blocks in the future. But I believe
this PR lays the groundwork, and future additions for Markdown and reST
should be less costly to add.

It's strongly recommended to review this PR commit-by-commit. The last
few commits in particular implement the bulk of the work here and
represent the denser portions.

Some things worth mentioning:

* The formatter is itself not perfect, and it is possible for it to
produce invalid Python code. Because of this, reformatted code snippets
are checked for Python validity. If they aren't valid, then we
(unfortunately silently) bail on formatting that code snippet.
* There are a couple places where it would be nice to at least warn the
user that doctest formatting failed, but it wasn't clear to me what the
best way to do that is.
* I haven't yet run this in anger on a real world code base. I think
that should happen before merging.

Closes #7146 

## Test Plan

* [x] Pass the local test suite.
* [x] Scrutinize ecosystem changes.
* [x] Run this formatter on extant code and scrutinize the results.
(e.g., CPython, numpy.)
2023-11-27 11:14:55 -05:00
..
flake8_to_ruff Bump configparser from 3.0.2 to 3.0.3 (#8849) 2023-11-27 10:07:22 +00:00
ruff_benchmark Bump codspeed-criterion-compat from 2.3.1 to 2.3.3 (#8784) 2023-11-20 11:10:48 +00:00
ruff_cache Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_cli Factor out a builder to handle common integration test arguments (#8733) 2023-11-22 00:32:01 +00:00
ruff_dev Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_diagnostics Update applicability messages for clarity in tests (#8541) 2023-11-07 16:11:43 +00:00
ruff_formatter Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_index Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_linter Add advice for fixing RUF008 when mutability is not desired (#8853) 2023-11-27 09:27:22 -06:00
ruff_macros Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_notebook Avoid B015,B018 for last expression in a cell (#8815) 2023-11-22 15:33:23 +00:00
ruff_python_ast Remove #[allow(unused_variables)] from visitor methods (#8828) 2023-11-25 00:09:46 +00:00
ruff_python_codegen Update string nodes for implicit concatenation (#7927) 2023-11-24 17:55:41 -06:00
ruff_python_formatter format doctests in docstrings (#8811) 2023-11-27 11:14:55 -05:00
ruff_python_index Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_python_literal Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_python_parser Update string nodes for implicit concatenation (#7927) 2023-11-24 17:55:41 -06:00
ruff_python_resolver Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_python_semantic Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_python_stdlib Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_python_trivia Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_shrinking Bump version to v0.1.6 (#8744) 2023-11-17 13:29:19 -05:00
ruff_source_file Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_text_size Update to Rust 1.74 and use new clippy lints table (#8722) 2023-11-16 18:12:46 -05:00
ruff_wasm Bump wasm-bindgen-test from 0.3.37 to 0.3.38 (#8847) 2023-11-27 10:02:53 +00:00
ruff_workspace [pylint] Add allow-dunder-method-names setting for bad-dunder-method-name (PLW3201) (#8812) 2023-11-21 23:44:23 +00:00